您的位置:首页 > 其它

UbuntuServer搭建Git服务器之gitdeamon和gitweb(四)

2012-11-02 23:45 609 查看
用gitdeamon可以方便用户通过git协议来clone共享的版本库,其安装及简单应用如下:

1. 安装git-daemon-run

$sudo apt-get install git-daemon-run

2.配置git-daemon-run

$sudo vi /etc/sv/git-daemon/run

将:

#!/bin/sh

exec 2>&1

echo 'git-daemon starting.'

exec chpst -ugitdaemon \

"$(git --exec-path)"/git-daemon --verbose --reuseaddr \

--base-path=/var/cache /var/cache/git

修改为:

#!/bin/sh

exec 2>&1

echo 'git-daemon starting.'

exec chpst -ugitdaemon \

"$(git--exec-path)"/git-daemon –verbose –export-all --reuseaddr \

--base-path=/srv/GitRepositories/users //note: default port: 9418

3.重启机器

$sudo shutdown –r now

4.访问git clone

$git clonegit://10.60.1.20/wenlaixiang/test.git

Gitweb可以使用户通过浏览器访问所有版本库,下面就其安装及简单的应用介绍下。

1. Gitweb需要apache2的支持,所以首先要确定server上已安装了apache2,然后安装gitweb:

$sudo apt-get install gitweb

如果提示如下错误:Could not reliably determine the server's fullyqualified domain name, using 127.0.1.1 for ServerName,需要对httpd.conf进行编辑:

$sudo vi /etc/apache2/httpd.conf

在里面输入:ServerName localhost,出现这样错误的原因是因为DNS没配置好. 如果不想配置DNS, 就在httpd.conf , 在最前加入 ServerName localhost 即可。

2. 修改gitweb.conf文件中的$projectroot值,我们这里对用户空间所创建的版本库进行浏览。

$sudo vi /etc/gitweb.conf //修改$projectroot = “/home/gitadmin/repositories/users”。

$sudo chmod 755 –R /home/gitadmin //修改权限,一定是git的管理账号目录,否则任何的子目录都将是无权限的。如果出现no project found,查看此步。

对于每个用户空间所提交的git库,需要修改其权限,否则不会在web上显示,解决办法是定期执行sudo chmod755 –R /home/gitadmin命令,哎,没找到更好的方法呀。你有吗?请通知我呀。

3.修改description

vi /home/gitadmin/repositories/users /gituser/project_name.git/description

This is description

4. http://labserver/gitweb 便可以访问版本库了。

5. 增强gitweb,(未完成)。

辉辉
(FightingBull Studio)

欢迎转载,但请注明出处:http://blog.csdn.net/fightingbull
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: