I had some troubles using Git via HTTP/WebDAV, because it seems like Git does not correctly support HTTP authentication. Fortunately, it turned out that using a .netrc-file solves the problems.
The symptoms were the following: After successfully installing Redmine and Git using some nice instructions I found on a blog, I had permanent problems using the
git push command:
The strange thing was, that I always had to execute git push exactly three times, then it worked. After examination of the HTTP output produced with the command
GIT_CURL_VERBOSE=1 git push, I noticed that Git sends the HTTP authentication stuff only for the first
MKCOL WebDav command, not for the follwing two. Therefore it was necessary to execute the command three times. However, the solution to the problem was to create a
.netrc-file in the
$HOME-directory and provide it with the needed login:
Now the authentication information gets always passed to the server and therefore the
MKCOL commands are successfully executed.
Update: Another problem I just encountered was when uploading large files, it might occur that the DAV lock timeout mechanism might cause another “git-http-push failed” error:
The solution is to increase the timeout in your Apache configuration:
Update 2 (thanks to cschmidt): For reference (and to make it easier to find this article through search engines): the corresponding errors in the server log: