Don't understand german? Read or subscribe to my english-only feed.

gitosis – git repository hosting application

Quoting the package description of Debian’s gitosis:

gitosis aims to make hosting git repos easier and safer.
It manages multiple repositories under one user account,
using SSH keys to identify users. End users do not need
shell accounts on the server, they will talk to one shared
account that will not let them run arbitrary commands.

I’m pretty happy with mercurial at grml (see our instructions if you are interested in our setup details) because we follow a linear development model (and I try to keep it that way regarding the workflow). Though I was thinking about forking an existing project for grml without losing the possibility to sync with original upstream. The project in question uses git and as I really love the way branching works in git I wanted to give it a try using my own infrastructure. An easy way of doing so is using gitosis. Gebi already blogged about that but I wrote down the setup instructions if you want to use it on Debian/etch:

First of all make sure to have a recent git-core package from backports.org:

# cat /etc/apt/sources.list
[...]
deb http://www.backports.org/debian etch-backports main contrib non-free

# cat /etc/apt/preferences
[...]
Package: git-core
Pin: release a=etch-backports
Pin-Priority: 999

# apt-get update; apt-get install git-core

Install my Debian package of gitosis being based on Debian unstable’s version 0.2+20080319-3 and adjusted for use on Debian/etch (or build your own package using python2.4 in debian/rules and adjusting build-dependency for python-setuptools or install from source):

# wget http://grml.org/git/gitosis_0.2+20080319-3_all.deb
# dpkg -i gitosis_0.2+20080319-3_all.deb

Initialise setup with your own ssh key:

# sudo -H -u gitosis gitosis-init < /path/to/your/sshkey/id_rsa.pub

And finally clone the gitosis-admin repository for administration (see resources at the end of this article for further information):

% git clone gitosis@${SERVER}:gitosis-admin.git

Now adding new repositories is as easy as putting something like the following snippet to gitosis.conf of the gitosis-admin repository (don’t forget ‘git commit -a ; git push’ :-)):

[group demo]
members = mika@foo
writable = demo
mkdir demo ; cd demo
git init
$DO_SOME_STUFF
git add .
git remote add origin gitosis@$SERVER:demo
git push --all

That’s it!

I’m not yet sure what might be the best way to provide git as an official service for grml. This needs further investigation… (gitweb stuff, permission handling, integration with mercurial,…), though gitosis seems to be a nice start.

Useful resources:

2 Responses to “gitosis – git repository hosting application”

  1. murphee Says:

    A bit OT, but what do you guys think about GitHub:
    http://github.com/

  2. mika Says:

    @murphee: very nice stuff, we/I just prefer to host our own code/infrastructure. :)

    regards,
    -mika-