在密码中用斜杠克隆回购 [英] Clone a repo with Slash in Password

查看:166
本文介绍了在密码中用斜杠克隆回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

克隆回购可以使用

  git克隆https://用户名:password@github.com/username/完成repository.git 

但是,当密码包含正斜杠时,这不起作用。错误是:

 错误:无法在访问
时解析主机'klaus777:password'https:// klaus777 :password /.@bitbucket.org/romeo/server-code.git/info/refs

致命错误:HTTP请求失败

如果我的URL编码斜杠,我得到以下错误:

 错误:请求的URL在访问
时返回错误:401 https:// klaus777:password%2F%2E@bitbucket.org/romeo/server-code.git/info/refs

致命:HTTP请求失败

因此,问题:你如何处理密码中的正斜杠?

PS。如果我从网址中删除密码并在出现提示时提供密码,那么一切正常。

正确斜杠的百分比编码应单独为%2F ,勾选如果您需要编码您似乎的<。'(%2E 有你的密码。

  https:// klaus777:密码%2F。@ bitbucket.org / romeo / server-code .git 

虽然这似乎不适用于GitHub:OP克劳斯确认在评论中:


我更改了密码。



Cloning a repo can be done with

git clone https://username:password@github.com/username/repository.git

However, when the password contains a forward slash, this doesn't work. Error is:

error: Couldn't resolve host 'klaus777:password' while accessing 
https://klaus777:password/.@bitbucket.org/romeo/server-code.git/info/refs

fatal: HTTP request failed

If I URL Encode the Slash, I get the following error:

error: The requested URL returned error: 401 while accessing 
https://klaus777:password%2F%2E@bitbucket.org/romeo/server-code.git/info/refs

fatal: HTTP request failed

Hence, the question: How do you deal with forward slash in password?

PS. If I remove password from URL and provide it when prompted, everything works just fine.

解决方案

A percent encoding for forward slash should be %2F alone, check if you need to encode the '.' (%2E) that you seem to also have in your password.

https://klaus777:password%2F.@bitbucket.org/romeo/server-code.git

That doesn't seem to work for GitHub though: the OP Klaus confirms in the comments:

I changed the password.

这篇关于在密码中用斜杠克隆回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆