Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

I think the fact that WebDAV is getting used means that your CGI stuff is not configured properly.

Try to use the ScriptAlias directive the way they show it in the tutorial you said you were following.

ScriptAlias /git /usr/lib/git-core/git-http-backend
share|improve this answer
    
Hi. I started out using the ScriptAlias directive, but it didn't work. –  Nils Magne Lunde May 21 '12 at 6:06
    
Same problem here. Have you found a solution? –  theV0ID Nov 4 at 13:30
    
@theV0ID No, I never found a solution. Using GitHub now instead of a local Git server. –  Nils Magne Lunde Nov 5 at 8:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.