Saturday, August 1, 2009

On Version Control

While I'm sure that the paid services of github are great, I'm not convinced that I should be paying for private hosting of my repositories. So I needed to come up with a free solution that fit my development needs. I am a sole programmer for small Rails projects, but I needed a way to get my code from work to home (and vice versa) with limited trouble. Version control is the obvious solution, but there was some problems because my work machines are behind a VPN that I can't always connect to since it's a Windows only client, and I don't always want to start up Virtualbox to just checkout/checkin.

My first experience with version control was using subversion. I set up my own server at work, but the problem there was that I could only check in and out while at work (or on VPN), and I sometimes like to work on projects at home. I then started using Beanstalk, which has a really nice UI and design, but only gives one repository for free and doesn't give SSL access. I then moved to Assembla, which didn't give SSL access, but gave unlimited repos for free. They then decided to start charging, so I looked around again and found xp-dev. XP-Dev was great, unlimited repos, SSL access, and a sufficiently large disk quota. The problem is that they decided that in August they would move SSL access to a paid only service, so it was time to reassess my options.. It was also at this time I decided to move to git instead of svn.

My requirements for git hosting were:
  • Unlimited private repositories (or at least, many)
  • A large enough quota (> 100M) where I won't realistically have to worry about space
  • SSL (or otherwise secure) updates
  • Ability to access on and off my work VPN
  • Works across platform (primary OSX and Linux)
  • A copy of the repo on my work version control server.
What I came up with actually works quite well. I've been a happy user of Dropbox for a while now, so I created a 'git' directory there and initialized some bare repositories. From my local git repos, I push (as a local file) to the Dropbox directory as the origin. That repository then gets automatically updated on each server that has Dropbox installed on it and linked to my account (my work Linux machine and my home OSX machine.) When I am at work, I just pull whatever commits I had made. I also added another remote of my work's version control system and push changes (over ssh) to that as well.

Given git's distributed nature and Dropbox's ability to synchronize changes to multiple places (over SSL no less) all of my requirements are met for version control.

5 comments:

  1. I was wondering if this would work as I was trying to figure out how to manage a bunch of small repositories for some training I'm doing. This is pretty great, man. Thanks for sharing this. It's good to know that this is a workable solution for you.

    ReplyDelete
  2. Your solution works very well for me, thanks!

    I am trying to work on a personal project and since I wanted to protect the code, github wasn't an option (paid doesn't make sense for now). Moreover, I was too lazy to setup a secure gitosis on one of my external servers. I was tinkering with Dropbox to get something to work when I read your solution on SO.

    ReplyDelete
  3. Awesome! Found this via your great answer on stack overflow, you should consider linking to the answer (with code) from here! :)

    ReplyDelete
  4. hmm... why not just put your initial project i dropbox instead of pushing to another git repo in the dropbox?

    You can still use git

    ReplyDelete
  5. I liked your answer on stackoverflow so much I made a little "git dropbox" command to facilitate this flow for me: https://github.com/agnoster/git-dropbox/

    It's a little different, I actually use --mirror so that I know I've got all branches and tags backed up there, too, so it's not exactly the same as your process. I figured if it was dead-simple I'd use it more, and so far so good!

    ReplyDelete