Gitosis

NOTE: Gitosis has not had any revisions since September 2009, and is considered dead. The Gentoo overlays have moved to using Gitolite since then.

Introduction
Manage git repositories, provide access to them over SSH, with tight access control and not needing shell accounts.

'''NOTE: There is a gentoo fork of gitosis (gitosis-gentoo). This article uses the standard gitosis sources.'''

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.

Installing
Gitosis is marked unstable so if you are not using for your, you will need to add an entry to.

Now you should be able to emerge it.

This should merge without any issues. It installs all the gitosis files you need, as well as create a git user and group, and a place for your repositories to live in at.

You now are ready to start configuring gitosis.

Configuring
You'll need to generate an ssh key, if you don't already have one.

You will be prompted for a location to save the key, such as. This will create two files, and. Now you want to put up on your server using.

After you transfer, the following command switches to the git user, and starts using your ssh public key.

This creates the gitosis-admin repository which you will use to further setup gitosis. Before you clone the repository, you need to check whether the git user can visit your server via sshd. Make sure the ! after git in /etc/shadow is changed to *:

Now, start out by first cloning this repository.

In gentoo, we want git-daemon to run in nobody : nobody. This require the dirmode is set to 0755 in gitosis.conf.

Creating new repositories and adding users
Because this section is not Gentoo specific, it is recommended to go to the "Creating new repositories" and "Adding users" of the gitosis article.

The rest of this article assumes you have created a repository called test and it is publically accessible by git-daemon.

If you want to provide anonymous access to the repository, use git-daemon, which comes as part of git. The Gentoo package for provides an init script for you, so you just need to tweak the accompanying conf file, and add it to the default runlevel.

There are two ways you can choose to export your repositories. The first is to individually choose which repositories to export, or choose to export everything by default.

Selectively export
Open up, and update it to have:

Now you must have a file in each repository you want exported.

You can let gitosis do this for you. If you want every repositories to be exported except gitosis-admin, then you can set this in gitosis.conf:

or you can explicit tell gitosis that you want a repository to be export, but others not:

Export everything
Open up, and update it to have:

Starting it
You're all set to actually start git-daemon now.

Now you can try checking it out using the git protocol:

Assuming all is well, now you can add it to the default runlevel.