I use git for almost all my dev work, is fast, it works locally, and I can even use it as a quick deployment tool, by adding hooks, but when it comes to sharing a repository to other developers, I dont like the idea of creating a user account in the system for each developer, so the easiest and fastest way to solve this issue for me is using gitolite.
In this post I will describe the steps needed to setup a central repository for multiple users. I’m using Centos 5.5 as server and debian as a workstation
Create a user account in the server and install git
[root@bp ~]# useradd -m git [root@bp ~]# passwd git [root@bp ~]# yum install git
Copy your public key from our workstation to the server
If you don’t know how to setup an ssh passwordless login, take a look here
ivan@scorpion:~$ scp ~/.ssh/id_rsa.pub firstname.lastname@example.org:~/ivan.pub
Clone gitolite into the server
ivan@scorpion:~$ ssh git@bp git@bp: ~$ git clone git://github.com/sitaramc/gitolite git@bp: ~$ cd gitolite git@bp: ~$ src/gl-system-install git@bp: ~$ gl-setup ~/ivan.pub
Go to the workstation to manage the git repo
ivan@scorpion:~$ mkdir -p git/bprepo ivan@scorpion:~$ cd git/bprepo ivan@scorpion:~$ git clone git@bp:gitolite-admin
At this point we have 2 folders inside gitolite-admin conf/ and keydir/ the first one is used to create new repositories or add users to repositories the second one is for adding each user public key.
Once you have added new repositories and users you need to do a
git push origin master
on each new repo.