2

I'm struggling to set up a clean and working git server with gitweb without virtualhost.

Software

  • Debian 8
  • Apache 2.4

Initial setup

  • mod userdir activated
  • Apache DocumentRoot is /home/user/public_html
  • php5-cgi and related Apache modules enabled
  • added "user" to www-data and added correct permissions

Goal

Resources followed

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

Alias /git /home/user/git

<Directory /home/user/git>
 Options All
 AllowOverride All
 Require all granted

Options +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi
SetEnv GITWEB_CONFIG /etc/gitweb.conf

RewriteEngine on

RewriteRule ^([^.]+\.git.*)$ /git/gitweb.cgi/$0 [L,PT]
</Directory>

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

  SetEnv GIT_PROJECT_ROOT /home/user/git
  SetEnv GIT_HTTP_EXPORT_ALL
  SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER

/etc/apache2/conf-enabled/git.conf

<IfModule mod_alias.c>
  <IfModule mod_cgi.c>
    Define ENABLE_GITWEB
  </IfModule>
  <IfModule mod_cgid.c>
    Define ENABLE_GITWEB
  </IfModule>
</IfModule>

<IfDefine ENABLE_GITWEB>
  Alias /git /usr/share/gitweb

  <Directory /usr/share/gitweb>
    Options +FollowSymLinks +ExecCGI
    AddHandler cgi-script .cgi
 DirectoryIndex gitweb.cgi
  </Directory>
</IfDefine>

Right now http://myserver/git shows a list of repos, but http://myserver/git/repo.git/ is "not found" and gitweb is not accessible.

0

1 Answer 1

0

After installing gitweb via apt-get, you should run the following:

# a2enmod cgi
# service restart apache2

Then enter http://your-hostname/gitweb

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .