curl
seems to work fine, but git
does not. git
asks for a password, but then doesn't send any credentials.
Works: curl --netrc http://test.git.unsw.edu.au/
and curl -u username:password http://test.git.unsw.edu.au/
Doesn't work: git remote update
Password for 'http://[email protected]':
* Couldn't find host test.git.unsw.edu.au in the .netrc file; using defaults
User-Agent: git/1.7.9.5
Host: test.git.unsw.edu.au
Accept: */*
Pragma: no-cache
Why isn't git
sending credentials?
From an strace, I see:
- Read
.netrc
GET /repo/info/refs?service=git-receive-pack HTTP/1.1
- no credentialsHTTP/1.0 401 Unauthorized
- Read
.netrc
GET /repo/info/refs?service=git-receive-pack HTTP/1.0
- no credentialsHTTP/1.0 401 Unauthorized
- Prompt for password
- Read
.netrc
* Couldn't find host test.git.unsw.edu.au in the .netrc file; using defaults
GET /repo/info/refs?service=git-receive-pack HTTP/1.1
- no credentialsHTTP/1.0 401 Unauthorized
Git seems to only use
CURLAUTH_ANY
which does not work with my particular web server. My web server supportsNegotiate
andBasic
, so Git does not fallback toBasic
whenNegotiate
is not available on the client.Further, there seems to be no option to Git to use anything other than
CURLAUTH_ANY
.Looking at the manpage, it seems git doesn't take the username option when used with http. But if you put it in your .netrc file, curl should use it. The format for .netrc is