问题
Excuses:
I see this: Escape @ character in git proxy password
But It's about http.proxy
param, and p%4055
does not work for me about url
param.
My question:
I use git version 1.7.1
My password repository is: p@55
And I use gitlab
server, and centos
for client.
In .git/config
file, i have be like this:
[remote "origin"]
url = http://user:p@55@domain.com:port/repo.git
But when I pull it, Gave me this error:
error: Couldn't resolve host '55:domain.com' while accessing ...
I know about escape @
char, but:
I try p\@55
, Gave me this error:
fatal: bad config file line 8 in .git/config
I try p%4055
, Gave me this error:
error: The requested URL returned error: 401 while accessing ...
回答1:
I just upgrade git version from 1.7.1 to 2.11.1 and this worked for me:
url = http://user:p%4055@domain.com:port/repo.git
回答2:
Try using the URL Encoded value of the @ - (%40) symbol.
an example in your case:
URL = http://user:p%4055@domain.com:port/repo.git
Edit:
if above method doesn't work please use below method:
sshpass -p password git clone ssh://username@onboard.com/srv/git/repo
回答3:
You can use git credentials helper:
Is there a way to skip password typing when using https:// on GitHub?
来源:https://stackoverflow.com/questions/44733982/how-can-i-escape-of-password-in-git-url