Apps & OS's Coding Technology

Installing a Git (gitosis) server on CentOS 6.2

After recently changing my personal VPS over from a Ubuntu 11.04 system to a CentOS 6.2 I needed to setup a new git repository server of which I will be using for all of my private git repositories instead of hosting them over at Github, Github is perfect for all my open-source (non-private) project but for my personal/private projects I don’t really want to pay lots of money to Github that to be honest I don’t really have… so this is why I decided to setup my own private git server.

So, I only really had to make a few changes from my original Ubuntu 11.04 guide, which can be found here: so I thought I’d just give a quick list of the commands to install on CentOS 6.2, if you do however want to learn more about what the commands are doing etc. check out the above link 🙂

Lets get going…

Firstly we need to login as ‘root’ and then install a few things on our new CentOS 6.2 server, so let quickly just run..

yum install git python-setuptools

Next, we are going to get ready to download (git clone) gitosis so we can install it, run the following commands:-

mkdir ~/src
cd ~/src
git clone git://
cd gitosis
sudo python install

Now we create our system user..

adduser -r –shell /bin/sh -c ‘git version control’ –home-dir /home/git git

As per my Ubuntu guide, at this point you’ll need to copy up your local PC’s public key file ( to the server, for simplicity pop it in /tmp/ on the server so we can access it easily in the next step.. Now we are going to initialize gitosis and give access to the gitosis-admin repository to your local PC (hence copying up our file)

sudo -H -u git gitosis-init < /tmp/

You should now see a message like:

Initialized empty Git repository in ./
Initialized empty Git repository in ./

If it complains about the directory not existing, just create like so and then run the gitosis-init command above again..

mkdir -p /home/git/gitosis
chown -R git:git /home/git

Thats it… You should now be able to ‘clone’ the gitosis-admin repository to your local PC so that you can now add and manage your git projects and other users! Please see this article for more detail and how to add new users and create new repositories.

Hope you found this useful 🙂



One reply on “Installing a Git (gitosis) server on CentOS 6.2”