Git repositories with Slicehost

December 1st, 2009 by tgmcclen Leave a reply »

No doubt I am really happy with my Slicehost VPS, it has been so hassle free!  The best part about Slicehost is all the amazing articles they provide to help you get going with your slice.

I’ve setup my slice to host my private git repositories, particularly since I wanted to use them with Rails and Capistrano.  This article provide to be just what I needed:

http://articles.slicehost.com/2009/5/13/capistrano-series-setting-up-git

The article even shows you how to secure the shell that the git user has to avoid anyone SSHing into your box with their ID.  However, it doesn’t tell you what to do when you want to create another repository as you cannot switch to the git user while ever it is using the git-shell as opposed to a normal shell.  The trick is you need to switch with the root user as only they are allowed to provide an alternative shell.  Here are the commands once you have logged into your slice with a user that is able to sudo:

$ sudo su --shell /bin/bash git
$ cd /home/git
$ mkdir project2
$ cd project2
$ git --bare init
$ exit

Now your repository is good to go and you can follow the steps from “Making your first commit” section.

Advertisement

Leave a Reply