我正在努力设置一个干净的,有gitweb的没有虚拟主机的 git服务器。
软件
初始设置
目标
遵循资源
/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>
现在http://myserver/git显示了回购列表,但http://myserver/git/repo.git/是“找不到”,gitweb无法访问。
通过apt-get安装gitweb后,你应该运行以下命令:
# a2enmod cgi # service restart apache2
然后inputhttp:// your-hostname / gitweb