Changing the repository location for gitosis

Published May 24th 2011

This is how I did it on my company's git server, which resides on an Arch Linux box. Obviously, it's a very good idea to make a backup before starting a procedure like this.

To change the location of the repo you need to do 3 things:
1. Add a line to gitosis.conf telling it that the repo is not in the default location
2. Move the repository folder
3. Update a symlink to gitosis.conf

In the example below I am moving the repo from /srv/gitosis/repositories to /data/gitosis/repositories. Inside /srv/gitosis there is a symlink that looks like this, which has to be updated afterwards:

.gitosis.conf -> /srv/gitosis/repositories/gitosis-admin.git/gitosis.conf


I assume you are familiar with gitosis.conf, where you configure users, repos etc. Add this line:


repositories = /data/gitosis/repositories

Important: Push these changes before you move the repository folder

Moving the repository folder

mv /srv/gitosis/repositories /data/gitosis/repositories

Update the symlink

ln -s -f /data/gitosis/repositories/gitosis-admin.git/gitosis.conf /srv/gitosis/.gitosis.conf

Couldn't find any info on this online, so I wrote this post. Hope it helps.