I have desperately been trying to get push for git working through the "smart-http" mode using git-http-backend. However after many hours of testing and troubleshooting, I am still left with
error: Cannot access URL http://localhost/git/hello.git/, return code 22 fatal: git-http-push failed`
I am using latest versions of Ubuntu (12.04), Apache2 (2.2.22) and Git (126.96.36.199) and have followed different tutorials found on the Internet, like this one http://www.parallelsymmetry.com/howto/git.jsp.
My VHost file currently looks like this:
<VirtualHost *:80> SetEnv GIT_PROJECT_ROOT /var/www/git SetEnv GIT_HTTP_EXPORT_ALL SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER DocumentRoot /var/www/git ScriptAliasMatch \ "(?x)^/(.*?)\.git/(HEAD | \ info/refs | \ objects/info/[^/]+ | \ git-(upload|receive)-pack)$" \ /usr/lib/git-core/git-http-backend/$1/$2 <Directory /var/www/git> Options +ExecCGI +SymLinksIfOwnerMatch -MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost>
I have changed the ownership of the
/var/www/git folder to
root.www-data and for my test repositories I have enabled anonymous push by doing
git config http.receivepack true.
I have also tried with authenticated users but with the same outcome.
The repositories were created using:
sudo git init --bare --shared [repo-name]
While looking at the apache2 access.log, it appears to me that WebDAV is trying to be used, and that git-http-backend is never fired:
127.0.0.1 - - [20/May/2012:23:04:53 +0200] "GET /git/hello.git/info/refs?service=git-receive-pack HTTP/1.1" 200 207 "-" "git/188.8.131.52" 127.0.0.1 - - [20/May/2012:23:04:53 +0200] "GET /git/hello.git/HEAD HTTP/1.1" 200 232 "-" "git/184.108.40.206" 127.0.0.1 - - [20/May/2012:23:04:53 +0200] "PROPFIND /git/hello.git/ HTTP/1.1" 405 563 "-" "git/220.127.116.11"
What am I doing wrong? Is it an issue with the version of git and/or apache that I am using perhaps?
BTW: I have read all the git http related questions on ServerFault and StackOverflow, and none of them provided me with a solution, so please don't mark this as duplicate.