git 代碼服務器的網頁版gitweb的搭建


sudo apt-get install apache2 git-core gitweb
sudo a2enmod rewrite

 

#vi /etc/gitweb.conf 

$projectroot = "/home/git/work"; 我的git代碼庫project.git在/home/git/work/目錄下。注意是XXX.git所在的路徑,但是不要包含XXX.git
$git_temp = "/tmp";
#$home_link = $my_uri || "/";
$home_text = "indextext.html";
$projects_list = $projectroot;
$stylesheet = "/gitweb.css";
$logo = "/git-logo.png";
$favicon = "/git-favicon.png";
# enable human readable URLs
$feature{'pathinfo'}{'default'} = [1];

然后#vi /etc/apache2/sites-available/gitweb

<VirtualHost *>
ServerName git.mydomain.com
ServerAlias git

DocumentRoot /home/git/work
SetEnv GITWEB_CONFIG /etc/gitweb.conf

RewriteEngine on
RewriteRule ^/$ /gitweb [PT]
RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /gitweb%{REQUEST_URI} [L,PT]

# Aliases
ScriptAlias /gitweb /usr/lib/cgi-bin/gitweb.cgi
Alias /gitweb.css /usr/share/gitweb/gitweb.css
Alias /git-logo.png /usr/share/gitweb/git-logo.png
Alias /git-favicon.png /usr/share/gitweb/git-favicon.png

# Logfiles
ErrorLog /var/log/apache2/gitweb.error.log
CustomLog /var/log/apache2/gitweb.access.log combined
</VirtualHost>

再然后:

$sudo a2ensite gitweb

$sudo invoke-rc.d apache2 restart  重啟Apache

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM