3

I'm trying to use the smart HTTP functionality of git on my Ubuntu Server. I've read the documentation for both smart HTTP and git-http-backend, as well as the documentation for apache; but for the life of me, I can't figure out why this isn't working. I have a functionning Sonar server that's proxied through apache, which is working fine, but I can't get this to work. Namely, I keep getting a 403 error.

/etc/apache2/sites-available/git.conf

SetEnv GIT_PROJECT_ROOT /opt/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

<Directory "/opt/git">
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

<LocationMatch "^/git/.*/git-receive-pack$">
    AuthType Basic
    AuthName "Git Access"
    Order allow,deny
    Allow from all
    AuthUserFile /opt/git/.htpasswd
    Require valid-user
</LocationMatch>

I thought that maybe it was a permission issue, as www-data didn't have access to the /opt/git folder, so I created a new group, git-access and added both myself and www-data to that group, and changed the permissions of the /opt/git so that www-data was the group, with rw permission for the group and owner.

zymus@ubuntu:/etc/apache2/sites-available$ groups www-data
www-data : www-data git-access

zymus@ubuntu:/etc/apache2/sites-available$ ls -la /opt/git
total 56
drwxrwxr-x 13 git  git-access 4096 Mar  4 19:37 .
drwxr-xr-x  5 root root       4096 Jan 23 15:44 ..
-rw-rw-r--  1 git  git-access   50 Jan 26 13:34 .htpasswd
drwxrwxr--  7 git  git-access 4096 Mar  4 19:40 pokemod-game-api.git
drwxrwxr--  7 git  git-access 4096 Nov 25 23:18 pokenet-cms.git
drwxrwxr--  7 git  git-access 4096 Nov 25 23:20 pokenet-file-server.git
drwxrwxr--  3 git  git-access 4096 Jan 11 01:05 pokenet-game-client.git
drwxrwxr--  7 git  git-access 4096 Jan 16 21:57 pokenet-game-core.git
drwxrwxr--  7 git  git-access 4096 Nov 22 19:25 pokenet-game-server.git
drwxrwxr--  7 git  git-access 4096 Nov 25 23:26 pokenet-launcher.git
drwxrwxr--  7 git  git-access 4096 Dec 26 17:44 pokenet-login-client.git
drwxrwxr--  7 git  git-access 4096 Nov 22 19:24 pokenet-login-server.git
drwxrwxr--  7 git  git-access 4096 Dec  4 15:24 pokenet-login-token.git
drwxrwxr--  7 git  git-access 4096 Nov 23 00:03 zephyrion-core.git

zymus@ubuntu:/etc/apache2/sites-available$ groups zymus
zymus : zymus adm cdrom sudo dip plugdev lpadmin sambashare git git-access

zymus@ubuntu:/etc/apache2/sites-available$ groups www-data
www-data : www-data git-access

zymus@ubuntu:/etc/apache2/sites-available$ groups git
git : git git-access

zymus@ubuntu:/etc/apache2/sites-available$ cat /opt/git/.htpasswd
zymus:Git Access:*
5
  • Have you checked this bit from the documentation: Ensure mod_cgi, mod_alias, and mod_env are enabled?
    – zloster
    Mar 15, 2015 at 18:58
  • Also check this question.
    – zloster
    Mar 15, 2015 at 19:19
  • Yes those are enabled.
    – user351871
    Mar 15, 2015 at 21:03
  • Without seeing all your apache2.conf it's hard to give a definitive answer however did you try adding AllowOverride All to <Directory "/opt/git"> Mar 16, 2015 at 0:57
  • Have you checked the error log for the site? It might give a hint as to what's going wrong.
    – jelmer
    Jul 19, 2015 at 23:04

0

You must log in to answer this question.