搭建gitweb环境
gitweb是git提供的一个基于web的版本查看工具
在新版的git源码中,它已经打包进去了
我们可以使用cgi方式,让gitweb运行在apache中
安装配置如下:
#进入git的src目录中
cd /opt/ysz/src/git-1.7.0
make clean
#编译gitweb,GITWEB_PROJECTROOT为要查看的git仓库目录,bindir为git目录
make GITWEB_PROJECTROOT="/opt/gitroot/repositories/" bindir=/usr/local/bin gitweb
mkdir /opt/gitroot/repositories/gitweb
#将cgi文件和静态文件拷贝到某个地方
cp gitweb/gitweb.cgi /opt/gitroot/repositories/gitweb
cp gitweb/*.js gitweb/*.css gitweb/*.png /opt/gitroot/repositories/gitweb
配置Apache2:
<VirtualHost *:80>
DocumentRoot /opt/gitroot/repositories/gitweb
ServerName 10.10.71.10
ScriptAlias /gitweb /opt/gitroot/repositories/gitweb/gitweb.cgi
<Location />
AuthName "Access auth"
AuthType Basic
AuthUserFile /usr/local/apache2/conf/passwd
Require valid-user
</Location>
<Directory /opt/gitroot/repositories/gitweb>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
ErrorLog "/opt/log/apache2log/gitweb_error.log"
CustomLog "/opt/log/apache2log/gitweb_access.log" common
</VirtualHost>
这样配置后,就可以通过以下url访问gitweb了
http://10.10.71.10/gitweb
由于是基于web访问git仓库,所以加上基本的权限认证
使用apache配置了gitweb,采用了用户认证登录,现在想某些用户只能访问gitweb中的某些目录,怎么实现?
忘了邮箱。。。