I'd like to make a git repository available over a Nginx HTTPS server.
I've set the post-commit hook to run git-update-server-info in order to update the refs for the "dumb" backend.
Pulling updates over the HTTPS interface works fine, however, when initially checking out the repository it fails with:
[test@test ttt]$ git clone https://server/git/test.git/
Cloning into thesis...
Username:
Password:
error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c)
error: Unable to find 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c under https://test/git/test.git
Cannot obtain needed commit 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c
while processing commit 6c155f7098fd75f23edf71ac5b70b7c22f6070e7.
error: Fetch failed.
Manually running "git update-server-info" on the server-side repository does not fix the problem, but running "git gc" does.
However, the "git gc" fix only works until I push an update to the server, afterwards the whole "git clone" problem starts again.
On the server I'm running git 1.7.1 (from the Debian backports), on the client I'm running 1.7.2.2 (from Arch Linux)
Any开发者_运维百科 hints on how to solve this problem? Unfortunately running the "smart" HTTP backend is currently not an option.
Had the same error but including the username in the URL works for me:
https://myuser@server/git/test.git/
I have the same problem here, it seems like a bug to me: although git asks for username and password, it does not pass it to the server so the server correctly responds with a 401 (not authorized).
Only solution I found so far: setting up my netrc correctly. Simply put
machine <server>
login <username>
password <password>
in your $HOME/.netrc or $HOME/_netrc for msysgit, and the authentication will complete normally.
Try upgrading your client
http://support.github.com/discussions/repos/3829-cloningfetch-fails-for-repo-cannot-obtain-needed-commit
http://support.github.com/discussions/repos/5097-cannt-obtain-commit-while-httpsgithubcomajaxorgacegit-checkout
Or maybe read this for "Smart" http: http://progit.org/2010/03/04/smart-http.html
精彩评论