Setup your own git server !

                          Git server setup with with gitolite

Git is a distributed version control system which is developed by Linux Torvalds ( 2005) for the development of Linux Kernel project.  Performance wise I felt its far better than other version control systems like cvs and svn .

Here we have used two other tool to use the git function in more controlled way

1)      Gitolite : which will work with git and allow us to make a good control over the repositories and the users who are accessing on this projects.

2)       Gitweb : This is a nice front end for Git ( gitweb )

Installation of Git : –

# As root:

– Red Hat Enterprise Linux 5 / i386:

rpm -Uhv

– Red Hat Enterprise Linux 5 / x86_64:

rpm -Uhv 

# yum -y install git

Install Gitolite : –

# yum –enablerepo=epel-testing install gitolite

We should install epel repo via :

rpm -Uvh

Setup Gitolite environment : –  ( on Server )

# usermod -d /srv/git gitolite
# cd /srv/ ; mkdir git
#  chown gitolite:gitolite git/

Create the Administrator user to manage the Git repositories .

On any of you client machine , generate the pub key and copy this to the Git server

[[email protected] ~]$ ssh-keygen -t rsa -b 2048 -C “Admin”
# cp .ssh/   .ssh/
# scp   .ssh/  [email protected]:/tmp

Login back to the git server and switch the user as “gitolite “

# su – gitolite
# gl-setup /tmp/

After successful completion of this command , it will create two folders  “repositories and projects.list “
Now the git-admin ( from client machine ) can create his own repositories and users to access the repos .

[ From Client machine ]

Just introduce yourself to the Git server and this will provide you nice logs

# git config –global “Admin”
# git config –global [email protected]

Playing with Git : – ( git clone , git add and git push )

#  git clone [email protected]:/ gitolite-admin
#  cd repositories/gitolite-admin

This Admin repository  contains two files , one config folder and one Key folder .  config/ gitolite.conf will help you to manage the repos and users as follows

#  cat gitolite.conf
@developers = root hari william
@qa = jack lilly

repo    gitolite-admin
RW+ = @developers

RW+ = @developers
R = @qa

RW+ = @all

Note that you can specify the projects groups like @developers and @qa etc .

Also you can add any number of public keys from your project members inside key directory . Copy the keys like “ ,, etc .  Please note that you need to specify the same in gitolte.conf .

For example if the key name is then the allowed user in configuration file must be “lilly” ( with out .pub )

Once you complete the changes then update /push the files to master repo

# git remote –v
# git add .
# git commit –a –m “Added new entries in gitolite.conf and added new pub keys in key dir “
# git push origin master

That’s it ..You have successfully configured git with gitolite.  Now all your team members who have added the keys to git admin repo can create and push their own project !!

Just try , Its an awesome tool !!!