How to setup git server using gitolite in Ubuntu 11.10 Oneiric

We can build git server using gitolite which also we can host into our Ubuntu. First, we wil act as client which need SSH public keys. Generate our ssh public keys and copy into /tmp by :

ssh-keygen -t rsa
cp ~/.ssh/ /tmp/

Now, we should install dependencies packages by :

sudo apt-get install git gitolite git-daemon-run

Then, we can setup our global git configuration by :

git config --global "Your Name"
git config --global

Then we need to create git user by :

sudo adduser \
--system \
--shell /bin/bash \
--gecos 'git version control' \
--group \
--disabled-password \
--home /home/git \

Then we login into git user :

sudo su git
echo "PATH=$HOME/bin:$PATH" > ~/.bashrc
gl-setup /tmp/

Just save it by “:wq” (VIM). Now you should exit and try to clone git-admin using your default user account (not git).

git clone git@ubuntu:gitolite-admin.git

Create new repository by editing “gitolite-admin/conf/gitolite.conf”, eg :

repo gitolite-admin
RW+ = @all

repo insurances
RW+ = @all

Then you can try to commit this repo :

git add -A
git commit -m 'create new repo'
git push origin master

Then you can clone new repo by :

git clone git@:insurances

It easy to host git server into your PC with gitolite and Ubuntu :D

12 thoughts on “How to setup git server using gitolite in Ubuntu 11.10 Oneiric

  1. Pingback: Example how to git submodule, add, delete submodule and use existed git repository | Django Best Practice

  2. Fantastic tutorial, still looking for a little help though!

    I know the focus of the article isn’t on using Eclipse with Git but that’s what I’m having trouble with now… and I can’t find any resources outside of Eclipse + GitHub which have been entirely useless to me.

    I’m trying to Import a Project from Git but my URI:git://host/repo_name continually fails to produce a clone for me. Reason: Exception caught during execution of the ls-remote command.

    Any ideas? Anyone?

  3. I get the following error when trying to clone the gitolite-admin repo:

    ssh: Could not resolve hostname ubuntu: Name or service not known.

  4. Hi,
    Thanks for the tuto.
    I have added my repo in gitolite-admin/conf/gitolite.conf but when I run
    $ git add -A I got the following error :
    fatal: Not a git repository (or any parent up to mount parent )
    Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

    Thanks for your help.

  5. nice,

    > echo “PATH=$HOME/bin:$PATH” > ~/.bashrc
    may be not usefull

    > git config –global “Your Name”
    > git config –global
    should be first or after install done, not in the middle

  6. Be forewarned, I am completely new to git….

    I was able to get through the tutorial and create a new repository locally following the commands in the tutorial. I have setup this environment in a VM. Now, I am trying to create a new repo and do commit’s from my host OS but am not having any luck. It keeps prompting me for a password when I issue a git command to git@hostname:reponame. I’m sure it’s something simple with the ssh-key but I’m not sure how to proceed.

    Thanks in advance for any advice!

  7. Pingback: Setting up a gitolite server in Ubuntu | Marian Schedenig's Website

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>