How to set up a remote Git server

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.

Compatibility checklist

I was planning on watching Digg’s Townhall, but I saw the topics they talk about and they’re all the same. Mostly power users and duplicate content. In response to those Jay and Kevin will just say “Yeah, we’re working on those. You’ll see changes in the coming weeks.” Ad infinitum.

My Firefox seems to be getting laggy. Extensive JavaScript and Flash ads make my iTunes jump. I know it’s nothing to do with Firefox, and is probably more to do with my laptop being in near constant use for the last year without ever having much maintenance upon it. So, I’m thinking maybe it’s time to start afresh. Not just with a new Windows XP reinstall, but with a whole new operating system.

I think I’m going to be switching to Debian, before I do though, I want to make sure I won’t lose any programs that’re vital to me. I thought here would be a good place to go through them and check for alternatives.

Continue reading

Access your uni drive from anywhere

This is mostly for DMU students, but this might actually turn into a WinSCP tutorial.

Turns out some people didn’t know they have access to their H drive from outside of the lab, so lemme explain how.

Your H drive is actually stored on a Linux server, where you have your own user. I doubt that means much to you if you have to be reading this, but it’s cool. It’s basically having your own account on the operating system, and you can do a lot more than just host files on there, but that’s all we’re bothered about at the moment.

You’ll need to download WinSCP. Install that with the Norton Commander view when prompted for it. Open it up when it’s installed, you’ll get this screen. Fill it up with your information!

WinSCP login screen with my DMU information in it

WinSCP login screen with my DMU information in it

The host name is sftp.cse.dmu.ac.uk, and your username is your P number, with the password you use to log into lab computers. Make sure the file protocol is SFTP.

Then press login, and it’ll take a few seconds to connect. Then you’ll get an window like this:

This is what it looks like when I log in

This is what it looks like when I log in

On the left is the machine that you’re working on now (known as the local machine). They’re all your files and folders on your computer. On the right is your harddrive on DMU’s servers (the remote machine). You can drag and drop files and folders from one computer to the other however you like from then on.

Remember though, don’t delete any of the .whatever files. They’re all configuration files for Linux. To be honest, unless you use PuTTY to access the server command line styles you’ll never be affected by them.