Installing a gitolite server on Ubuntu

Gitolite First install git server if not already installed

sudo apt-get install git-core

introduce yourself to git

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Install gitolite server

sudo apt-get install gitolite

Create a user for gitolite

sudo adduser --system --shell /bin/bash --group --disabled-password --home /home/git git  

On local machine copy your public key to the /tmp directoy

cp ~/.ssh/id_rsa.pub /tmp/$(whoami).pub

or from a remote machine

scp ~/.ssh/id_rsa.pub you@git-server-IP-address:/tmp/you.pub

Switch to the git user and import the administrator's key into gitolite environment

sudo su - git
gl-setup /tmp/*.pub

Now exit and copy the admin repro

git clone git@127.0.0.1:gitolite-admin.git
cd gitolite-admin

Configure the admin repro and commit changes

Add group called dev and allow users to read and write to myproject repro

repo    gitolite-admin
     RW+     =   admin
@dev = user1 user2
repo    myproject
     RW+     =   @dev

Add the two users public keys to keydir directory as user1.pub user2.pub

Commit the changes

git add keydir/user1.pub
git add keydir/user2.pub
git commit -a -m "Added Dev Group and user1 and user2"
git push

Login from user1 workstation to test it works.

git clone git@IP-Address-of-git-server:myproject.git

Good Luck!

Hassan El-Masri

Network Consultant Engineer

comments powered by Disqus