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 Linode.com 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 scie.nti.st, we grab the gitosis code (still remote):
cd ~/src
git clone git://eagain.net/gitosis.git
Then:
cd gitosis sudo apt-get install python-setuptools sudo python setup.py 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
--system
--shell /bin/sh
--gecos 'git version control'
--group
--disabled-password
--home /home/git
git
I copied my public ssh key from my workstation to the remote server at /tmp/id_rsa.pub
, (tmp avoids perms issues with git) then run
sudo -H -u git gitosis-init < /tmp/id_rsa.pub
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:
Host www.example.com
Port 32767
Then you can do:
git clone git@YOUR_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.