Gitweb setup for Gentoo

參考自: http://robbat2.livejournal.com/218418.html

編輯:
/etc/apache2/vhosts.d/00_default_vhost.conf
加上:
ServerName localhost
Include /etc/apache2/vhosts.d/default_vhost.include
ServerEnvironment apache apache

Added by Derek Dai

To support configure for host specific web applications

Include /etc/apache2/webapps.d/localhost/*.conf

建立目錄:
/etc/apache2/webapps.d/localhost
建立檔案:
/etc/apache2/webapps.d/localhost/01_gitweb.conf
加入以下內容:
Alias /git/ /usr/share/git/gitweb/

AllowOverride AuthConfig
Options +ExecCGI +Indexes
Order allow,deny
Allow from all
DirectoryIndex gitweb.cgi
SetEnv GITWEB_CONFIG "/etc/gitweb.conf"
AddHandler cgi-script .cgi

建立 gitweb 設定:
/etc/gitweb.conf
加入以下內容:
$feature{'blame'}{'default'} = [1];
$feature{'blame'}{'override'} = 1;
$feature{'pickaxe'}{'default'} = [1];
$feature{'pickaxe'}{'override'} = 1;
$feature{'search'}{'default'} = [1];
$feature{'search'}{'override'} = 1;
$feature{'grep'}{'default'} = [1];
$feature{'grep'}{'override'} = 1;
$feature{'snapshot'}{'default'} = ['tgz', 'tbz2', 'zip'];
$feature{'snapshot'}{'override'} = 1;

$projectroot = '/var/spool/gitosis/repositories';

$projectroot 要改指向你放置 git repositories 的根目錄