Install GitWeb to work with Gitosis Installation

First create a virtual host for gitweb in apache

DocumentRoot /home/
CustomLog /var/log/httpd/ combined
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi

    AllowOverride All
    Options All
    Order allow,deny
    Allow from all
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.* /gitweb.cgi/$0 [L,PT]

NOTE: since wordpress is not converting < tag in virtual host entry, i have uploaded actual virtual host used here

GitWeb is part of git installation. If you have installed git from source, you will see gitweb folder inside git source.

Copy gitweb to docroot of your web site.

mkdir -p /home/
cd /usr/local/src/git*/gitweb
cp -Rf * /home/

After visiting the web site, i got following error

 Can't locate in @INC (@INC contains:

So i installed perl-CGI

yum install perl-CGI

Now sites start working, but did not show any repository.

Now you need to edit gitweb.cgi and set path to repository.

Edit gitweb.cgi

vi gitweb.cgi


our $projectroot = "/pub/git";

Replace with your gitosis install path

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

Now gitweb will show all repos.

To show only selected projects in gitweb, edit gitweb.cgi


our $projects_list = "";

Replace with

our $projects_list = "projects.txt";

Now create a file “projects.txt” with name of repos you want to show in gitweb.

root@server70 [/home/]# cat projects.txt



root@server70 [/home/]#

Posted in Git