Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 "[email protected]" and I have to use port 2077. This means I have to do something like

git config remote.origin.pushurl http://[email protected]@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      [email protected]
password   ****

but that didn't seem to help.

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

like image 318
kbro Avatar asked Jan 05 '10 19:01

kbro


2 Answers

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%[email protected]: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.

like image 121
Gabriel Avatar answered Oct 31 '22 13:10

Gabriel


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://[email protected]:2077/repo.git?

like image 21
VonC Avatar answered Oct 31 '22 13:10

VonC