My next natural step after getting my projects up and running with Git was to install a web interface. Gitweb was my choice because:
- it’s available via yum with Fedora
- it provides up-to-date diff information
- it’s part of the overall Git package, so it’s tightly integrated
Installation was ultimately quite simple, but I found the install docs to be less than helpful for people like me who want immediate functionality and will get to the tweaks and details later.
Step 1: Install Gitweb
sudo yum install gitweb
This will install a few files at /var/www/git. You shouldn’t need to do anything to them.
Step 2: Create /etc/gitweb.conf
You need a configuration file to tell Gitweb where to look for your project. You can change this folder to wherever your project will be.
$ echo "\\$projectroot = '/srv/git/';" > /etc/gitweb.conf
Step 3: Edit Apache Configuration File
This configuration file assumes you are running your site as a virtual host, in this case
DocumentRoot /var/www/git ServerName git.yourproject.com Allow from all AllowOverride all Order allow,deny Options ExecCGI SetHandler cgi-script DirectoryIndex gitweb.cgi SetEnv GITWEB_CONFIG /etc/gitweb.conf
Step 3: Tweak Your Repository’s Config File
Gitweb lists two key elements at the start of your project’s page: description and owner. To have these display something appropriate, edit ~~~/srv/git/yourproject.git/description~~~
My Awesome Project
… and add this to
[gitweb] owner = "Mark McBride"
Step 4: Restart Apache
That’s it. Just restart Apache and you should find Gitweb running at the domain you’ve specified.