Gitolite

This page describes a gitolite installation.

Installation

Copy public key to /tmp/foo.pub.

Install gitolite:

$ apt-get install gitolite

This creates a user gitolite and uses /var/www/gitolite as repository location. To change those settings reconfigure gitolite:

$ dpkg-reconfigure gitolite

Then delete the old user and repository location:

$ deluser gitolite
$ rm -rf /var/lib/gitolite/

Administration

Clone the admin repo:

$ git clone git@server.example.com:gitolite-admin.git

Users

To add an user just put the SSH public key into the keydir directory:

$ ls -1 keydir
bar.pub
foo.pub

It is possible to add multiple keys for a user. Name the public keys like <username>@<machine>.pub. For example:

$ ls -1 keydir
bar.pub
foo@desktop.pub
foo@laptop.pub

Repositories

To add a new repostiory just add two lines to conf/gitolite.conf:

repo    my-project
        RW+     =   foo,bar
        R       =   www-data

Then commit and push the changes. This creates an empty bare git repository.

$ git commit -am "Added my-project"
$ git push

Then you can use and existing or new local git repository and connect it:

$ git remote add origin git@server.example.com:my-project
$ git push origin master

Sources: