Ubuntu上搭建并配置gitweb

来源:互联网 发布:林书豪上赛季数据 编辑:程序博客网 时间:2024/05/03 15:55

装好了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,应该可以看到正常的库列表了。



0 0