Every change to the configuration of gitosis should be pushed to gitosis-admin.git, and the changes will automatically be reflected. We should not change the gitosis-admin.git directly at the server (spilka). So, first clone the gitosis-admin.git:
$ git clone git@spilka:gitosis-admin.git
Now you have a directory named gitosis-admin, which has two major parts: gitosis.conf and gitosis-export/keydir.
The gitosis.conf file is the control file you use to specify users,
repositories and permissions. The keydir directory is where you store the public keys of all the users
who have any sort of permissions to your repositories: one file per user.
How to add an user?
First get the public key from the user and put it in the keydir directory as a file whose name ends with ".pub".
For example the public key of user at hostserver1 should be pasted in the file
user@hostserver1.pub. Each file "*.pub" should contain one public key. If the user uses many machines then create different such files for different machines.
Now in the gitosis.conf, you can add an user and keys for many machines like this:
[group user]
members = user@desktop user@hostserver2, user@hostserver1
where user@desktop and others refer to the files containing different keys
at gitosis-export/keydir.
You can add repositories and group members in the following way:
[group h2dev]
writable = hermes2d hermes1d himg
members = @user1 @user2 @user3
If web interface is needed, then add something like this in gitosis.conf:
[repo hermes2d]
daemon = yes
gitweb = yes
The new user can now try doing:
$ git clone git@spilka.math.unr.edu:project.git
or push to the official repos to which he has permission in gitosis.conf.
First add a new user "git" and then sudo su git:
$ adduser git
$ sudo su git
Go to $HOME and make the directory:
$ cd
$ mkdir -p user/lib/python/
Put the following at the beginning of .bashrc:
export PYTHONPATH=$PYTHONPATH:$HOME/usr/lib/python/
export PATH="$HOME/usr/bin:$PATH"
(If you don't put it at the beginning, the ssh will not run it
due to the line "[ -z "$PS1" ] && return" in the bashrc.)
Next, you clone and install Gitosis from Ondrej's repo (gitosis
needed couple patches to make it work on spilka):
$ mkdir repos; cd repos
$ git clone git://github.com/certik/gitosis.git
$ cd gitosis
$ git checkout --track origin/pu
$ python setup.py install --home=~/usr
To initialize Gitosis, first copy your public key to /tmp and then do:
$ gitosis-init < /tmp/id_rsa.pub
$ cd repositories/gitosis-admin.git
$ chmod 755 hooks/post-update
Also change "git-update-server-info" to "git update-server-info" in post-update
$GIT_DIR=. hooks/post-update
Then, clone the gitosis-admin.git:
$ git clone git@spilka:gitosis-admin.git
Now, you have a directory named gitosis-admin, which has two major parts:
gitosis.conf and gitosis-export/keydir, which you can change according to your need. After making changes you can push back so that the changes will be reflected. Please see the above section (Configuration of Gitosis) for details.