Friday, March 2, 2012

How to Install Gitolite in Centos or Redhat or Fedora

NOTE : This Tutorial is tested on CentOS, Fedora & Redhat.


How to install Gitolite for Hosting Git Repository ?

What is Git ?

         Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do.

More Info HERE

What is Gitolite ?

          Gitolite allows you to setup git hosting on a central server, with fine-grained access control and many more powerful features.

           Gitolite is an access control layer on top of git. Here's an "executive summary":
  • use a single unix user ("real" user) on the server
  •  provide access to many gitolite users
  •  they are not "real" users 
  • they do not get shell access
  • control access to many git repositories 
  • read access controlled at the repo level 
  • write access controlled at the branch/tag/file/directory level, including who can rewind, create, and delete branches/tags 
  • can be installed without root access, assuming git and perl are already installed 
  • authentication is most commonly done using sshd, but you can also use httpd if you prefer (this may require root access)          

More Info HERE

Install Gitolite :

Prerequisites:

Perl 5.8.8
git (yum install git)
 
  (1) First Login as root & Add user called "git" 
$ useradd git
$ passwd git








(2) Now Login as root to any local system & Add user called "gitadmin"
 $ useradd gitadmin
 $ passwd gitadmin 








(3) Switch to User gitadmin & generate ssh key as shown
$ su gitadmin
$ ssh-keygen
















(4) Copy ssh public key as gitadmin.pub
$ cp .ssh/id_rsa.pub gitadmin.pub




(5)  Now Copy this ssh key on git server
$ scp gitadmin.pub git@gitserver:



(6) Now Login to git server as user "git" & download gitolite source
$ git clone http://github.com/sitaramc/gitolite.git







(7) Change directory gitolite & run "gl-system-install" command
$ cd gitolite/
$ src/gl-system-install











(8)  Now run "gl-setup" command
$ source .bash_profile
$ gl-setup gitadmin.pub
(9) once you run "gl-setup gitadmin.pub" command hit enter & then the Vi editor pops up, exit it by typing ":wq" (colon, then the letter 'w' & 'q'), hit enter. Then the installs complete.



 








(10) Finally clone the gitolite admin repository
$ git clone git@gitserver:gitolite-admin.git







3 comments:

  1. @ step 4, access denied. can't make this done >

    cp .ssh/id_rsa.pub gitadmin.pub

    permission denied. how can i give permission to gitadmin that it can copy that?

    ReplyDelete
  2. u should create ssh key as gitadmin user . . . & this key will be created as /home/gitadmin/.ssh/id_rsa.pub & you can copy that key as gitadmin.pub using command "cp /home/gitadmin/.ssh/id_rsa.pub gitadmin.pub" send me the output of ls -l /home/gitadmin/.ssh

    ReplyDelete
  3. i dont think it makes any difference that im using ubuntu for my local system.. but i've added gitadmin as a user and made a password for it. but when I change user to gitadmin, I only get the "$" for my console, and not gitadmin@computer..

    forgive me, i just started trying to use linux, and yet im here installing git and gitolite..

    ReplyDelete