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 http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
– Red Hat Enterprise Linux 5 / x86_64:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
# yum -y install git
Install Gitolite : –
# yum –enablerepo=epel-testing install gitolite
We should install epel repo via :
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm http://fedoraproject.org/wiki/EPEL/FAQ#How_can_I_install_the_packages_from_the_EPEL_software_repository.3F
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
Login back to the git server and switch the user as “gitolite “
# su – gitolite
# gl-setup /tmp/ git-admin.pub
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 user.name “Admin”
# git config –global user.email [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
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 “hari.pub , jack.pub, William.pub etc . Please note that you need to specify the same in gitolte.conf .
For example if the key name is lilly.pub 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 !!!