How I set up

March 29, 2013


GitHub doesn't let you host private repositories for free. (Also, their commit list view is silly.) GitLab's setup is ridiculous. Getting hosted on might be an option, but I haven't explored it thoroughly.

It was a dark and stormy night

Actually, I was "studying" for finals when I stumbled across gitolite. Gitolite lets you host multiple git repos for multiple users and gives you finer-grained control than GitHub (per-branch and read-only permissions, in particular). It's even packaged in Debian!

Unfortunately, if you install from the Debian wheezy packages (at the time of writing, wheezy is testing), you're a bit out of luck. The official documentation is wrong, the README is wrong, and this guide specifically for Debian is less wrong, but still wrong.


Actually, the Debian-specific guide is pretty close. The critical missing step is after installing gitolite but before trying to switch users, you have to create the user first.

sudo adduser --system --home /var/lib/gitolite --shell /bin/bash git

A lot of guides mention creating a gitolite user, but that means your git urls look like Instead, I create a git user. Also, when running gl-setup, it will give you the option to edit the .gitolite.rc file. You should take this opportunity to set

$REPO_UMASK = 0027;

because why not and, later, when you set up a web interface, you'll need it.

gitweb sucks (or how to setup cgit)

cgit is great. It's just a frontend for repositories. No issue tracking, pull requests... no redis dependencies, nothing. Just diffs and downloads.

git clone git://
cd cgit
git submodule init
git submodule update

Set up a /etc/cgitrc


root-desc=repository browser


Set up your webserver. In my case, I symlinked

$ ll /var/www/
total 4.0K
-rw-r--r-- 1 root root 36 Mar 27 22:58 about.html
lrwxrwxrwx 1 root root 25 Mar 27 23:08 cgit.cgi -> /home/raylu/src/cgit/cgit
lrwxrwxrwx 1 root root 29 Mar 27 23:08 cgit.css -> /home/raylu/src/cgit/cgit.css
lrwxrwxrwx 1 root root 29 Mar 27 23:08 cgit.png -> /home/raylu/src/cgit/cgit.png

After enabling the lighttpd cgi module, I added this to my lighttpd.conf

$HTTP["host"] == "" {
    alias.url = (
        "/cgit.css" => "/var/www/",
        "/cgit.png" => "/var/www/",
        "/cgit.cgi" => "/var/www/",
        "/"         => "/var/www/",
    cgi.assign = ( "cgit.cgi" => "" )
    url.rewrite-once = (
        "^/cgit\.(css|png)" => "$0",
        "^/.+" => "/cgit.cgi$0"

And you're done. Unless you don't see any commits, in which case you probably want to

sudo chgrp -R www-data /var/lib/gitolite/{repositories,projects.list}
sudo chmod g+r /var/lib/gitolite/repositories
sudo chmod g-r /var/lib/gitolite/repositories/gitolite-admin.git