您的位置:首页 > 其它

Ubuntu上搭建并配置gitweb

2016-04-27 13:52 351 查看
装好了git server,就需要开通gitweb,方便代码查看。

OS: Ubuntu 12.04 LTS 64bit.

以下是安装纪录。

sudo apt-getinstall gitweb apache2

cd /var/www

sudo ln -s /usr/share/gitweb/* .

修改配置文件/etc/gitweb.conf:

sudo vi /etc/gitweb.conf

把$projectroot改为存放git的目录。在我这里是/home/git/repositories.
把$projectroot改为/etc/gitweb-list

例:

# path to git projects (<project>.git)

$projectroot = "/home/git/repositories";

# directory to use for temp files

$git_temp = "/tmp";

# target of the home link on top of all pages

#$home_link = $my_uri || "/";

# html text to include at home page

$home_text = "indextext.html";

# file with project list; by default, simply scan the projectroot dir.

$projects_list = "/etc/gitweb-list";

# stylesheet to use

$stylesheet = "/css/gitweb/gitweb.css";

# logo to use

$logo = "/css/gitweb/git-logo.png";

# the 'favicon'

$favicon = "/css/gitweb/git-favicon.png";

$feature{'snapshot'}{'default'} = [0];

增加/etc/gitweb-list文件,里面的内容是需要显示的git库名及owner,例

testing.git   Tony

test2.git   Jack

...

由于权限管理用的是gitolite,还需要如下改动,否则将没有权限访问。

sudo usermod -a -G git www-data

sudo chmod g+r /home/git/projects.list

sudo service apache2 restart

 

       同时需要在git配置文件中,把gitweb帐号加入,如下(以testing库为例,其它库同上):

repo testing

  RW+= @all

  R =gitweb

 

完成后用游览器打开 http://192.168.0.xx/gitweb,应该可以看到正常的库列表了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: