Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
851 views
in Technique[技术] by (71.8m points)

escaping - How can I escape `@` of password in git URL

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@[email protected]: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 ...
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I just upgrade git version from 1.7.1 to 2.11.1 and this worked for me:

url = http://user:p%[email protected]:port/repo.git

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
...