Git push over http (using git-http-backend) and Apache is not working
Posted
by
Ole_Brun
on Server Fault
See other posts from Server Fault
or by Ole_Brun
Published on 2012-05-20T21:30:27Z
Indexed on
2012/09/05
21:40 UTC
Read the original article
Hit count: 411
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 (1.7.9.5) 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/1.7.9.5"
127.0.0.1 - - [20/May/2012:23:04:53 +0200] "GET /git/hello.git/HEAD HTTP/1.1" 200 232 "-" "git/1.7.9.5"
127.0.0.1 - - [20/May/2012:23:04:53 +0200] "PROPFIND /git/hello.git/ HTTP/1.1" 405 563 "-" "git/1.7.9.5"
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.
© Server Fault or respective owner