How to set up your own git server on your VPS / Dedicated server using gitolite

| | 2 min read

If you own a VPS or a dedicated server or a hosting server which allows you to have shell access then you can easily set up your own git server with as many users and as many repositories as can be stored in the space on your server. All you need to do this is a bit of system administration skills and a hosting server that allows you shell access. Read on to see how you can set up your own git server.

The server software that will allow you to do this is gitolite. Another alternative is gitosis but the capabilities offered by gitolite is way ahead of gitosis. The main advantage of gitolite over gitosis is the ability to control user permissions on a branch basis in each repository. This is very critical to enforce git based development workflows. The installation of gitolite is very simple.

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

You can then create a symlink to the gitolite script to one of the paths in your $PATH variable.

Now copy over your public key from your local machine to a file yourname.pub on the server and run

gitolite setup -pk path_to_yourname.pub

This will create the gitolite admin repository and set you as the administrator. Now all you have to do is to clone the admin repo on the machine from where you took your public key from and then make changes in the gitolite.conf to create repositories and set permissions to people work on the repositories or the branches in these repositories.

More documentation on gitolite can be found at the gitolite project site.

If you don't already have a VPS or a shared server we would recommend one of the following providers for your VPS / Dedicated server needs - Linode, WiredTree or Innohosting. We have hosted with all of these and have been pretty satisfied with the services of these providers.