Giving cgit a go on Ubuntu, a quick tryout tutorial

After being annoyed by the snapshot filenames of gitweb, I started looking around. A patch to fix the problem has already been submitted to the gitweb developers and if they see the need it will be part of a future release. Bored of waiting, I tried cgit.

cgit is currently at version 0.8.3 and still needs some testing and security checks before it gets to version 1.0 (according to their own README), but that is no reason not to try it out locally.

At the time of writing there are were no packages available, so I decided to create one and post in to my PPA. If you have apache set up and running and know a bit of what you are doing, get that package and let's take it for a spin.

Install the package
As cgit is a single package it is probably easiest to just download it from the details. Adding the PPA according to the instructions is also an option, but make sure you don't install the single letter gnome menu I put in there if you don't want that. (If that happens, use synaptic and use that to downgrade the gnome-menu package again).

Set up and configuration
I have not added the documentation to the cgit package yet (may do that in the future), this means that it's best read online.

Create a directory where you will do your test run and symlink all the cgit stuff you need into that directory

mkdir cgit
cd cgit
ln -s /usr/lib/cgi-bin/cgit cgit.cgi
ln -s /usr/share/cgit/* ./

You should now have cgit.{cgi,png,css} in there. Add apache configuration, I have a AllowOverride All on my local apache server to make this easy, here is my .htaccess:
Options +ExecCGI
SetEnv CGIT_CONFIG ./cgitrc

As you can see, we are going to create the cgitrc file in the local directory. This is a test run after all, but normally you would create a file at /etc/cgitrc for this. My local apache hosts this directory at http://localhost/bram/cgit/ which makes the root of the logo and stylesheet different from the default. I also decided to try the local directory as git repo root where we will create a quick repo for testing later. This concludes all we need to tell cgit:
logo=/bram/cgit/cgit.png
css=/bram/cgit/cgit.css
scan-path=git

Now all we need to do is create that scan-path directory and see if everything works:
mkdir -p git/test
cd git/test
git init
echo Hello from cgit > README
git add README
git commit -a -m "Oooh yeah"

The point your browser to your localhost and see the glory! Even though I have not looked at the code yet, cgit feels like a good product and seems to be just as easy to set up as gitweb.