搭建 gitweb 的步骤

访问量: 851

如何搭建捏?

见这个教程。
http://serverfault.com/questions/72732/how-to-set-up-gitweb

绝对不要用这个教程。 不好使
http://ao2.it/wiki/How_to_setup_a_GIT_server_with_gitosis_and_gitweb

下面就是步骤,虽然原文强调在 ubuntu 8.04下适用,但是我在 ubuntu10下面一样没问题:)

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


Assuming that you git projects are in /pub/git,
edit the file: /etc/gitweb.conf

$projectroot = "/pub/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];

Now, setup a new virtual host in Apache config directory. Edit a new file called: /etc/apache2/sites-available/gitweb
<VirtualHost *>
   ServerName     git.mydomain.com
   ServerAlias    git

   DocumentRoot /pub/git
   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>

Enable the new site:

sudo a2ensite gitweb

Restart Apache:

sudo invoke-rc.d apache2 restart

订阅/RSS Feed

Subscribe

分类/category