Home > Software management > Setting Up a Git Server on Ubuntu

Setting Up a Git Server on Ubuntu

September 13th, 2011 Leave a comment Go to comments

Git is a version control system used by many projects such as Linaro, the Linux kernel, Android, Eclipse, Qt and more. For projects that can not afford their own servers and still need to collaborate, hosted git is available from github and as today there are a total of 2,769,642 repositories (private and public) hosted on github.

For software developed internally, you can start to setup you own Git server by following some simple steps (in Ubuntu).

Installing the Git Server

Update Ubuntu and install git-core:

sudo apt-get update
sudo apt-get install git-core

That’s it.

Installing Gitolite

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

First get gitolite with git:

git clone git://github.com/sitaramc/gitolite.git

Obtain a public key based access to your server, so that you can log in from your workstation to the server without getting a password prompt.

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa jaufranc@CNX-NETBOOK

Install gitoline:

./gl-easy-install -q jaufranc CNX-NETBOOK Jean-Luc

The first parameter (jaufranc) is your username, the second (CNX-NETBOOK) the hostname and the third (Jean-Luc) the name you’d like to be called.

Gitoline is now installed with 2 default repository gitoline-admin and testing.

Adding a Repository

First clone gitoline-admin repository:

git clone CNX-NETBOOK:gitolite-admin

Add the repository (cnxapp in this example) in gitoline.conf:

cd gitolite-admin/conf
vi gitolite.conf

and modify the file as follows:

@swdev = Jean-Luc

repo    gitolite-admin
RW+     =   Jean-Luc

repo    testing
RW+     =   @all

repo    cnxapp
RW+     =   @swdev

I’ve also defined a group (swdev) to add more developers later on. Please check the instructions to add more users if you want to do so.

That’s it now, you should be able to clone the directory with git clone [email protected]:cnxapp and add files, commit and push them to the Git server.

More detailed information is available on Pro Git.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Categories: Software management Tags: git, gitolite, ubuntu
  1. November 11th, 2011 at 00:24 | #1

    my apologies for changing all the URLs but there was a very good reason: the docs were too long and people kept telling me they didn’t read because of that.

    Anyway the new URL for the link you have toward the end of your blog post is http://sitaramc.github.com/gitolite/add.html

    Also, I should tell you that the install method you use is obsolete now (was obsoleted around the time of your blog post), and was deprecated for about 4-5 months prior.

    Sorry…

  2. November 11th, 2011 at 09:39 | #2

    @sitaram
    Hi Sitaram,

    Thanks for letting me know. I’ve updated the blog post with the new link.
    Do you have instructions for the new installation method ?

    Jean-Luc

  1. No trackbacks yet.