首先要配置apache服务器的配置文件:
/etc/httpd/conf/httpd.conf
[root@localhost conf]# pwd
/etc/httpd/conf
[root@localhost conf]# ls
httpd.conf magic
[root@localhost conf]# pwd
/etc/httpd/conf
[root@localhost conf]#
要在最下面加上如下的语句
<VirtualHost *:80>
ServerName 192.168.110.123
DocumentRoot /var/www/git
<Directory /var/www/git>
Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi
</Directory>
</VirtualHost>
上面指定了服务器启动脚本的位置以及启动脚本
gitweb.cgi static
[root@localhost git]# pwd
/var/www/git
[root@localhost git]# ls
gitweb.cgi static
[root@localhost git]#
其次是对gitweb的配置文件进行修改:
/etc/gitweb.conf
$projectroot = "/home/git/repositories";
指明仓库的位置
[root@localhost repositories]# ls
favicon.ico image6500.git light_logo.png poweredby.png
gitosis-admin.git light_button.png mediatek.git test.git
[root@localhost repositories]# ls
favicon.ico image6500.git light_logo.png poweredby.png
gitosis-admin.git light_button.png mediatek.git test.git
[root@localhost repositories]# cd test.it
bash: cd: test.it: 没有那个文件或目录
[root@localhost repositories]# cd test.git
[root@localhost test.git]# ls
branches description HEAD info refs
config git-daemon-export-ok hooks objects
[root@localhost test.git]#
最后是运行:
service httpd start
ok,可以运行起来了
http://192.168.110.123
gitosis-admin.git
Unnamed repository; edit this...
7 weeks ago
summary | shortlog | log | tree
image6500.git
Unnamed repository; edit this...
5 months ago
summary | shortlog | log | tree
mediatek.git
Unnamed repository; edit this...
5 months ago
summary | shortlog | log | tree
test.git
Unnamed repository; edit this...
5 months ago
summary | shortlog | log | tree