curl似乎工作正常,但git没有。 git要求input密码,但是不会发送任何凭据。
作品: curl --netrc http://test.git.unsw.edu.au/和curl -u username:password http://test.git.unsw.edu.au/
不起作用: 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
为什么不是git发送凭据?
从一个strace,我看到:
.netrc GET /repo/info/refs?service=git-receive-pack HTTP/1.1 – 没有证书 HTTP/1.0 401 Unauthorized .netrc GET /repo/info/refs?service=git-receive-pack HTTP/1.0 – 无凭据 HTTP/1.0 401 Unauthorized .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 – 没有证书 HTTP/1.0 401 Unauthorized 看看手册页,似乎git不使用用户名选项时使用http。 但是,如果你把它放在你的.netrc文件中,curl应该使用它。 .netrc的格式是
machine hostname login yourusername password yourpassword
混帐似乎只使用CURLAUTH_ANY这不适用于我的特定Web服务器。 我的Web服务器支持Negotiate和Basic所以当Negotiate在客户端上不可用时,git不会回退到Basic 。 此外,似乎没有选项可以使用除CURLAUTH_ANY其他任何东西。