I’ve been using github for a while now, which is fine for my public projects. There are obviously some that I want kept private though. I could pay for a github account, or I could make use of the VPS I’m already paying for and install git on there.
I was going to blog about this process from the start, but then I found a really decent article by Bradley Wright describing exactly what I wanted and figured I’d be wasting my time. I’ve run into a few problems though that the article didn’t seem to come across.
As I said, first I used Wright’s article, How to set up your own private Git server on Linux. I did pretty much everything on there, and everything worked brilliantly.
I came back to my local machine and added the remote host
git remote add vps git@shamess.info:~git/todoapp.git
Here’s where I ran into another problem when I tried to push to it.
fatal: The remote end hung up unexpectedly
That took an embarrassingly long time time to realise that I had just forgotten to fire up Pageant – this error just means that you couldn’t be authorised, so the server booted you off. This made me happy because it meant that my repos are private by default, I guess.
Even using the git:// url (which apparently only has read access), I still get an error. I’m not entirely sure this is expected, but if not it’s broken in my favour since I’ll only be accessing via ssh.
Back to my first push attempt though. After starting up Pageant I still ran into an error trying to push.
fatal: 'git/todoapp.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
This took a little longer to track down, but I eventually found that it was an issue with the path I was giving it. This actually has nothing to do with git, and was just that I was giving SSH a bad URL to head to.
SSH doesn’t follow relative URLs when it’s connecting, and so you need to list the full path. I went with git remote add vps git@shamess.info:/home/git/todoapp.git, however I think just git remote add vps git@shamess.info:todoapp.git would have sufficed (since SSH would login at the git user’s home directory anyway).
That has me pretty much set up now! I hope someone finds this post once they fall into the same problems as I did, and find my resources helpful.

