Getting started with git
9. May 2013

After using svn for some years, I would like to try a “new” approach. So I decided to migrate my repos to git and install something like a git server using gitolite.

During the journey I was inspired by There were also some interesting facts about how to work with git on

The Server


Doing as root on the server machine

I will use the root user on my server to manage gitolite. So I create the ssh key for my gitolite user in the .ssh directory of the root-user on my server. Afterwards it is an easy task to copy the key to another machine or give some other users the permissions to manage the gitolite-admin repo.

cd ~/.ssh
ssh-keygen -t rsa -f gitolite

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

cp ~/.ssh/ /home/gitolite/

To let ssh know, that it has to use the right key when you work with git, just add the following to ~/.ssh/config:

Host localhost
   User gitolite
   Hostname localhost
   Port 22
   IdentityFile ~/.ssh/gitolite


Doing as gitolite user on the server machine

After creating the gitolite user, it’s time to install and configure gitolite.

cd ~
git clone git://
mkdir ~/bin
gitolite/install -to /home/gitolite/bin
/home/gitolite/bin/gitolite setup -pk



To configure your gitolite server, you have to checkout the gitolite-admin repo. While I created a key-pair called gitolite and configured ssh for my root-user to use the corresponding key when connecting to localhost, I am now able to clone the repo. This could be done as following:

cd ~
git clone localhost:gitolite-admin

After doing so, you can add your users keys to gitolite-admin/keydir as <username>.pub and configure the repositories and their permissions in gitolite-admin/conf/gitolite.conf. After committing and pushing the repo back to the server, the config will be active.



Create a new repo inside the actual directory

git init

Clone an existing repo locally

git clone <host>:<repo>

Push your version of the master branch into the repo

git push origin master

Add remote location to local repo

git remote add origin <host>:<repo>


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.