194z357uvg 发表于 2016-5-12 10:24:30

redhat/centos 6.3 搭建git/gitosis/gitweb详细过程(2)

1. gitweb安装
注意:redhat的iso源是没有gitweb安装包,但是centos的源中有,在上一篇文章中给出了如何让redhat使用centos的源,那么,只需采用如下命令即可安装。


[*]# yum install gitweb

2. gitweb配置gitweb默认安装到了/var/www/git下,其配置文件在/etc/gitweb.conf下,另外,httpd的配置文件/etc/httpd/conf.d/git.conf。
(1)修改/etc/gitweb.conf


[*]$projectroot = "/var/www/git" //将projectroot修改为/var/www/git

(2)修改/etc/httpd/conf.d/git.conf


[*]Alias /git /var/www/git
[*]<Directory /var/www/git>
[*]Allow from all
[*]AllowOverride all
[*]Order allow,deny
[*]Options +ExecCGI
[*]AddHandler cgi-script .cgi
[*]DirectoryIndex gitweb.cgi
[*]SetEnv GITWEB_CONFIG /etc/gitweb.conf
[*]Dav On
[*]RewriteEngine Off
[*]</Directory>



(3)重启httpd

[*]/etc/init.d/httpd restart

(4)将gitosis仓库连接到/var/www/git下,完成web显示

[*]ln -s /home/git/repositories/test_repo.git /var/www/git/

(5)通过浏览器浏览
http://xxxx/git/


注意: 如果git clone http://xxx/git/test_repo.git时出现git update-server-info错误,则在test_repos.git目录下执行 git update-server-info 命令即可(gitosis服务器的相应仓库下)。


3. 创建新的git repository
在git server的/home/git/repository目录下,执行如下命令:


[*]mkdir test.git
[*]cd test.git
[*]git init --bare
[*]//可以在这里添加源文件,也可以在client端clone之后添加
页: [1]
查看完整版本: redhat/centos 6.3 搭建git/gitosis/gitweb详细过程(2)