gitapachedebianegitsmart-http

Git, Debian, Apache and Smart HTTP


I am trying to set up git on my Debian server. However, I'm going crazy about this Smart HTTP stuff, as I want to use the Egit plug-in for eclipse and it requires Smart HTTP. And for this reason I'm unable to push my local branch to the remote repository on my server. I have installed Apache and Git 1.7.2.3. I'm using Basic Authentication and have enabled mod_cgi, mod_env and mod_alias. My apache config file for the git stuff is located at /etc/apache2/sites-available/git and has about the following contents:

 <VirtualHost *:80>
         Servername git.mydomain.com
         DocumentRoot /var/git
         SetEnv GIT_PROJECT_ROOT /var/git/
         SetEnv GIT_HTTP_EXPORT_ALL
         ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
         <Directory "/var/git">
            DAV On
            Options +Indexes +FollowSymLinks
            Deny from all
            AuthType Basic
            AuthName "git repository"
            AuthUserFile /var/git/.htpasswd
            AuthGroupFile /var/git/.htgroup
         </Directory>
         <Directory /var/git/allternative>
                 Allow from all
                 Order allow,deny
                 Require group allternative
         </Directory>
         <Directory "/usr/lib/git-core/git-receive-pack">
                 Allow from all
                 Order allow,deny
                 Require group allternative
         </Directory>
 </VirtualHost>

The diretories are the following:

I did everything that I read on this article (and many others saying about the same): http://progit.org/2010/03/04/smart-http.html

I still get the error from Egit that remote Smart HTTP is not enabled. What am I missing?

Thanks in advance, Andreas


Solution

  • Answering my own question: I replaced the ScriptAlias directive with this:

      ScriptAliasMatch \
        "(?x)^/(.*/(HEAD | \
          info/refs | \
            objects/(info/[^/]+ | \
              [0-9a-f]{2}/[0-9a-f]{38} | \
                pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
                  git-(upload|receive)-pack))$" \
                   "/usr/lib/git-core/git-http-backend/$1"
    

    And Also added the following directive:

    SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
    

    Then it worked. I found those two settings on http://www.espace.com.eg/blog/2010/11/10/migrating-from-subversion-to-git/ and I'm not exactly sure which one of the two solved the problem, but I assume it was the SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER directive.