Installing Git and gitosis on Ubuntu

Gitosis is now deprecated. Check out Gitolite instead.

I’m switching all my personal projects to git from Subversion. To that end, I’ve set up a remote git repository on my VPS running Ubuntu. Here’s how to do it:

First, install git on the remote server:

sudo apt-get install git-core

Then, following instructions on, we grab the gitosis code (still remote):

cd ~/src
git clone git://


cd gitosis
sudo apt-get install python-setuptools
sudo python install           # I had to do sudo here
sudo apt-get install python-setuptools # I also needed these tools

Next, create a git user to own the repositories:

sudo adduser 
    --shell /bin/sh 
    --gecos 'git version control' 
    --home /home/git 

I copied my public ssh key from my workstation to the remote server at /tmp/, (tmp avoids perms issues with git) then run

sudo -H -u git gitosis-init < /tmp/
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

And that’s the end of the server-side setup! On the local machine, we check out the files that are needed to control the server.

If you run SSH on a nonstandard port: edit ~/.ssh/config and put this inside:

    Port 32767

Then you can do:

git clone [email protected]_SERVER_HOSTNAME:gitosis-admin.git
cd gitosis-admin

The gitosis-admin is the directory where you administer gitosis. From this point on, you don’t need to be on your server. All configuration takes place locally and you push the changes to your server when you’re ready for them to take effect.


comments powered by Disqus