Mercurial with TortoiseHG

Tech Notes

So here are the steps I followed to get this working. I looked around for a complete end to end tutorial without success. So here is an amalgam of the release notes. https://bitbucket.org/tortoisehg/stable/wiki/ssh http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter9.html#pageant

  1. Download
    1. PuttyGen : http://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe
    2. TortoiseHG : http://tortoisehg.bitbucket.org/download/index.html
  2. Install TortoiseHG, log out and log in again.
  3. Launch PuttyGen and make a key.
    1. Press Generate
    2. Check SSH-2 RSA
    3. Number of bits : 1024
    4. Press `Save public key` - name the file id_rsa.pub in `My Documents`
    5. Press `Save private key` - name the file id_rsa.ppk ( ppk will be added by default ) in `My Documents`
    6. [[{"type":"media","view_mode":"media_large","fid":"420","attributes":{"class":"media-image size-full wp-image-911 alignleft","typeof":"foaf:Image","style":"","width":"250","height":"246","title":"PuttyGen","alt":"PuttyGen"}}]]
  4. Add the key to Pageant (the Putty agent) that will provide your keys to Tortoise on demand.
    1. Navigate to the Tortoise install directory. C:\Program Files\TortoiseHG\Pageant.exe
    2. Open Pageant. This will place Pageant in the task bar near the clock. The icon is a computer wearing a gangster hat.
    3. Right click the icon and choose `Add key`.
    4. Load the .ppk private key from disk. The first time the key is used each log on you will be prompted for your passphrase.
    5. [[{"type":"media","view_mode":"media_large","fid":"421","attributes":{"class":"media-image size-full wp-image-915 alignright","typeof":"foaf:Image","style":"","width":"151","height":"136","title":"pageant","alt":"pageant"}}]]
  5. Add the key to the server (hg host) authorized_keys file ( or authorized_keys2 )
    1. Right click id_rsa.pub and select Open > with Notepad
    2. Copy just the key - probably starts with `AA` and ends with `=`
    3. SSH into the server and edit ~/.ssh/authorized_keys - paste in the key on a new line and follow it with a comment - username@host is the convention
    4. Optionally restrict it to just running hg (mercurial) command="hg -R [pathto]/[repo] serve --stdio" ssh-rsa AAAA1[long alphanumeric string]WFk= [username]@[host]
  6. To test clone a remote repository.
    1. Right click on the Windows desktop.
    2. In the Tortoise submenu choose clone.
    3. Add a directory name to the destination path.
    4. replace the source path with your remote repository path. ssh://[username]@[remotehost]:[port]/[pathto]/[repo];
    5. Press Clone. During the cloning process you can F5 the folder to check its progress.
    6. [[{"type":"media","view_mode":"media_large","fid":"422","attributes":{"class":"media-image size-full wp-image-916 alignleft","typeof":"foaf:Image","style":"","width":"265","height":"180","title":"Clone","alt":"Clone"}}]]