This old site is no longer updated. Visit the new site.

Installing a git server using gitosis

I’m switching all my personal projects to git from Subversion. After watching the Peepcode git screencast, Subversion feels oh-so-2002 and I can’t wait to bury it forever.

First we have to get git running on my Ubuntu server. I tried

sudo apt-get install git-core #do not do this!

but that led to trouble down the line. Better to just fetch the source and build from that:

sudo apt-get install libexpat1-dev zlibc curl gettext
cd ~/src
cd git-1.5.4.rc2
make prefix=/usr/local all
sudo make prefix=/usr/local install

Then, following the excellent instructions on, we grab the gitosis code:

cd ~/src
git clone git://


cd gitosis
sudo apt-get install python-setuptools
python install

Next we have to create a git user to own the repositories:

sudo adduser \
    --system \
    --shell /bin/sh \
    --gecos 'git version control' \
    --group \
    --disabled-password \
    --home /home/git \

We copy my public ssh key into /tmp/, then run

sudo -H -u git gitosis-init < /tmp/
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

And that’s the end of the server-side setup! On the local machine, we check out the files that are needed to control the server. First we have to account for the fact that I run SSH on a nonstandard port: edit ~/.ssh/config and put this inside:

    Port 32767

Then you can do:

git clone [email protected]_SERVER_HOSTNAME:gitosis-admin.git
cd gitosis-admin

This is the directory where you administer gitosis.