开发者

git http push via WebDAV - what if my username has an "@" in it?

My web hosting provider lets me access my webspace via WebDAV, so I thought I'd set up a git repository over there just to see what happens. Cloning the repository read-only works just fine, as "git clone http://my.server.com/repo.git" just uses the standard HTTP transport.

Problems arise when I try to use WebDAV, because my user id is "user@my.server.com" and I have to use port 2077. This means I have to do something like

git config remote.origin.pushurl http://user@my.server.com@my.server.com:2077/repo.git

and the two @ signs in the URL must be causing problems because "git push origin master" reports "error 22".

I tried creating a .netrc file entry

machine    my.server.com
login      user@my.server.com
password   ****

but that didn't seem 开发者_运维技巧to help.

I've also tried replacing the first "@" with a "%", "\@" and "%40" but none of those worked.


The current version of git doesn't handle percent-unescaping in username and password. I submitted a patch yesterday to fix this (at least for HTTP URLs) so it might be fixed soon. With the patch, you should be able to access the WebDAV with:

git config remote.origin.pushurl http://user%40my.server.com@my.server.com:2077/repo.git

However you may have another problem related to an issue with libcurl > 7.16 (see the note in "git help http-push") at the time I'm writing.


If the URI used by WebDAV does follow the Uniform Resource Identifier (URI): Generic Syntax (rfc3986), there should not be any @ in the userinfo

 authority     = [ userinfo "@" ] host [ ":" port ]
 userinfo      = *( unreserved / pct-encoded / sub-delims / ":" )
 pct-encoded   = "%" HEXDIG HEXDIG

 unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
 sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
               / "*" / "+" / "," / ";" / "="


 reserved      = gen-delims / sub-delims
 gen-delims    = ":" / "/" / "?" / "#" / "[" / "]" / "@"

So did you try just with http://user@my.server.com:2077/repo.git?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜