Install Gitosis on Debian Squeeze

You can use gitosis to allow people to collaborate on a project via git. Its a utility to allow read and write access based on SSH encryption keys. And you only need to create a single system account, not one for every contributor.

First, install gitosis:

apt-get install gitosis

Now you are ready to go with the user account gitosis. But if you want to use the system account git so that the git clone ... URLs are shorter, you have to set up this user on your own:

adduser --system --shell /bin/sh --gecos 'git repository hosting' \
  --group --disabled-password --home /home/git git

Now generate an SSH keypair from the user of YOUR local computer:

ssh-keygen -t rsa

then copy to the server, to /tmp for example. You can do this via scp ~/.ssh/ SOME_USER@YOUR_SERVER_HOSTNAME:/tmp.
Now initialize gitosis with the new public key:

su git
gitosis-init < /tmp/

Now get the gitosis administration repository on your local computer, change the settings, commit and push them back to the server:

git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git
cd gitosis-admin
##  Now adjust `gitosis.conf` to your needs.
##  The names of members must correspond to the filnames in the subfolder gitosis-admin/keydir.
##  Enough for your needs should be the follwing example to add a new group *board* with write-
##  access to the repositories *Charta* and *templates* (will create the repos automatically):
cat << EOF >> gitosis.conf
[group board]
members = richard
writable = Charta templates
## now commit and push back
git add . && git commit && git push

Now you can push any git repository to the remote repositories Charta and templates:

# In any local git repository run:
git remote add origin git@YOUR_SERVER_HOSTNAME:Charta.git
git push origin master