Step-by-step Setup TortoiseHg for gitHub

This is a step-by-step instruction to setup TortoiseHg (A GUI shell extension  for Mercurial SCM) to use with github (Online project hosting using git Version Control System).


There are few articles around the web with the same topics.

I was able to setup my TortoiseHg to work with github using the instruction written by James McKay. The document is very informative, but some of the steps are not written in details.
Thus, I decided to write this documents to include some steps with additional screen shots.



1. Install TortoiseHg


 2. Install hg-git

hg-git can be download by cloning the repository directly.
  • Start TortoiseHg workbench.
  • Select File > Clone Repository...
Clone Repository
  • Configure clone repository dialog box. (#1)
    • Source       :
    • Destination: c:\hg-git
hg-git Clone Configuration
  • Click OK to start cloning.
  • Wait until repository cloning finished. 
Cloning Finished


3.Configure hg-git

The following steps had to be done by direct editing mercurial.ini file. 

  • This file can be access from File > Settings
  • Click "Edit File" button in "Global Settings" tab.
Global Settings - Edit mercurial.ini
  • Add the following lines to your configuration file:
hggit = C:\hg-git\hggit

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


4. Create github account


Create new account at github (if you don't have an account yet), else skip this step.


5. Create SSH public and private keys


github required a SSH key in order to push repository to github.

To generate public and private SSH keys, you will need the PuTTYgen from the PuTTY package.
You can get PuTTY from
You may choose to download either PuTTYgen.exe or the entire PuTTY package (zip)

  • Execute PuTTYgen.exe
PuTTY Generator
  • Click "Generate" to generate new key (1). (Note: Move mouse in application window to generate random values.)
  • Create password for your key (2). (Optional)
  • Save your private key. (3)
  • Save your public key. (4)
Now, you have your own pair of SSH private and public keys pair. Next, you will need to tell github your SSH public key.

6. Register SSH public key to github

  • Login to github
  • Select account settings.
github Account settings
  • Select "SSH Keys"
github Menu
  • Click "Add SSH Key"
github Add SSH Key
  • Copy SSH public key from PuTTYgen (5) then paste to Key in github. Give your key a title.
We are now ready to upload our repository to github.


7. Create new repository in github

Before we can push our repository to github, the repository must be created.
Click "Create new Repo" in github page to create new repository.

8. Upload repository from TortoiseHg to github

  • Start Pageant in C:\Program Files\TortoiseHg\Pageant.exe
  • To load your SSH private key, right key at Peageant taskbar icon.
  • Click "Add Key" then select your SSH private key file.
    Note: you will be prompt for password if password is defined.

  • Select "synchronize"tab for repository that you wish to upload to github in Tortoise Hg Workbench.
  • With remote repository settings set to "local", type in the following command. (1)
  git+ssh://<User Name>/MSChartExtension.git

  • Push repository from TortoiseHg to github using the push button. (2).
  • Use pull  incoming changes to update repository from github. (3)

 That's all. Happy coding.

Version History


29/04/2012     Created

Popular posts from this blog

C# DSP Simulation - DSP Lab

C# DSP Toolbox: Digital Filters (Updated)