Setting Up Hg-Git

7/28/2011

So apparently it takes the people at CodePlex a little while to make the switch to Mercury from SVN because, as I go to the site now, my code repository is coming up Subversion. It's only been eight days though since Wade from Chinasoft (who apparently does their tech support) contacted me, and this would fall under low priority, so I'll give it a little more time but seriously someone needs to automate that process. In the mean time I've set up both a bitbucket and github site. Now the bitbucket setup was simple, install TortoiseHg and I'm done. Setting up github was a bit more in depth. I mean I could just set up git, but I hate the command line. Give me a GUI and I'm happy (I know, I'm odd for a programmer). So instead I decided to set up Hg-Git.

Hg-Git is a plugin for mercury that allows you to connect to git repositories and it's kind of a pain to set up. Well not really. It only takes a couple of steps:

Install Hg-Git - you can use TortoiseHg to get the latest version from the repository here. All you have to do is download it, it's a bunch of python code so nothing to install.

Now we set it up - Open up TortoiseHg's Hg Workbench, go to File->Settings->Edit File (it's a button on the upper right side). From there we enter the following and save it:

[extensions] hggit = Location that you saved Hg-Git to

hgext.bookmarks =

[ui] ssh = "C:\Program Files\TortoiseHg\TortoisePlink.exe"

Once we do that we need to create a public/private key pair. I used PuTTY for this. Just install it and run the PuTTYgen app, hit Generate, and save the public and private key to your hard drive.

Once the keys are generated, we need to add our key to github. If you go into your Account Settings, there is a link that says SSH Public Keys on the left side. Once there the middle portion should say Add another public key. Copy and paste the public key that you saved earlier into there and hit save.

Now we just need to setup Pageant (it's installed already at this point). Add a shortcut to the Startup folder with the following:

"C:\Program Files\TortoiseHg\Pageant.exe" "Location of the private key that you saved earlier"

From here on you should be able to clone your repository and start pushing code. However I've learned that I need to set the master bookmark to whatever I actually want to push for some odd reason. That doesn't seem like something I should have to do but it is what it is. Anyway, that's what I went through to get it up and running. For now I'll be updating the code on those two pages and not the CodePlex page (that will change once they actually update my repository there). So choose whichever you like more and happy coding. Oh and I've set it up to link to the Twitter account (sorry for spamming the tests earlier today), so if you want to keep up to date with both my site here and updates as I push them to github/bitbucket you will be able to do that now.