sudo vim /etc/gitweb.conf
# git倉(cāng)庫(kù)存放的目錄
# 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的話,gitweb會(huì)自動(dòng)在$projectroot定義的目錄下遞歸查找合法的git repo來(lái)顯示。
$projects_list = "/home/git/projects.list";
# $strict_export參數(shù)規(guī)定只有顯示在首頁(yè)上的repo才能夠被訪問(wèn)。換句話說(shuō)在有projects.list的情況下,該文件列出的repo才能被訪問(wèn)。
$strict_export = 1;
# stylesheet to use
#@stylesheets = ("static/gitweb.css");
# javascript code for gitweb
$javascript = "static/gitweb.js";
# logo to use
$logo = "static/git-logo.png";
# the 'favicon'
#$favicon = "static/git-favicon.png";
# git-diff-tree(1) options to use for generated patches
#@diff_opts = ("-M");
@diff_opts = ();
# $feature數(shù)組啟用了一些插件或者說(shuō)特性。blame可以顯示代碼來(lái)源人,snapshot提供repo的打包下載,highlight提供代碼高亮。
$feature {'blame'}{'default'} = [1];
$feature {'blame'}{'override'} = 1;
$feature {'snapshot'}{'default'} = ['zip', 'tgz'];
$feature {'snapshot'}{'override'} = 1;
$feature{'highlight'}{'default'} = [1];
git clone https://github.com/kogakure/gitweb-theme.git
cd gitweb-theme
sudo ./setup -vi --insstall
sudo service nginx restart
9、設(shè)置登錄認(rèn)證
sudo htpasswd -c /etc/nginx/gitweb.passwd name
在nginx配置中添加
auth_basic "請(qǐng)先登錄";
auth_basic_user_file /etc/nginx/gitweb.passwd;
進(jìn)入網(wǎng)站提示:
到這里就都搭建完成了~
附:GitWeb倉(cāng)庫(kù)配置(在具體的倉(cāng)庫(kù)中)
1、description 中可以設(shè)置倉(cāng)庫(kù)的描述
2、cloneurl 顯示該倉(cāng)庫(kù)的克隆路徑
3、README.html來(lái)創(chuàng)建你的倉(cāng)庫(kù)內(nèi)容描述
4、config中可以設(shè)置owner = Your Name
Create a “description” file in your git repository root, with a brief, one-line description of your repository. This file is treated as plain text, > > any HTML will be escaped. This will appear in the top section of the gitweb repository landing page.
Create a “cloneurl” file in your git repository root, containing one url per line. Use this to display the clone url for your repository. This will > appear in the same section as the description line, one url per line.
Create a “README.html” file in your git repository root, with arbitrary descriptive content. HTML is allowed, and will be displayed inside a > div tag on the gitweb page, in a section below the one with description.
Set the owner, by setting a gitweb.owner configuration variable in the “config” file, located in your git repository root. If the “gitweb” section does not exist, create it. The owner setting in the config should look like the sample below (you can use any arbitrary string for owner):
[gitweb]
owner = Your Name