This revision made June 30, 2009 02:43, by Paul

» Project Kenai Documentation and Training    » How Do I ...    » Using Mercurial on Microsoft Windows Systems

Setting Up Mercurial to Use SSH on a Microsoft Windows Machine

Before reading this section, make sure you've installed the Mercurial client. As described at About Mercurial, you can download the Mercurial client as an installable binary from http://www.selenic.com/mercurial/wiki/index.cgi. Use the default settings and ensure that the installer adds the Mercurial path to the system PATH environment variable.

In addition, these instructions assume that you've generated an SSH key with PuTTY as described at Generating and Using an SSH Key on a Microsoft Windows Machine.

Note: Thanks to Oliver Reed for his blog Setting up Trac, Mercurial, and SSH on Windows, which was very helpful in writing this page.

 

To use your SSH key with Mercurial, you need to configure it to use the PuTTY tools when using SSH. The Mercurial configuration file you'll use to do this is typically called .hgrc. On Windows it can also be called Mercurial.ini. The file is located in your home folder, for example, C:/Documents and Settings/your-username. If you don’t know what your home folder is, open a command windows and type echo %USERPROFILE% to see the path.

If you haven’t set up your configuration yet, then chances are the configuration file doesn’t exist, and you’ll have to create it. Create a file call either .hgrc or Mercurial.ini in your home folder manually, and open it in a text editor. For example, in Git Bash or Cygwin, you could create the file with the following command:

 ~ cat > .hgrc

You then type Ctrl-C to close the file and save it.

Here is what the ssh lines in the file would look like:

 [ui]
 ssh = plink -ssh -i "C:/path/to/key/id_rsa.ppk" -C -agent

This line tells Mercurial to use the plink program. This program comes with PuTTy and is a command-line version of what the PuTTY program does behind the scenes. Here's what the parameters mean:

  • -ssh: Indicates that Mercurial should use the SSH protocol.
  • -i “file.ppk”: Specifies the location of the private key file you want to use to log in to the remote server. Change this to point to your local putty-compatible .ppk private key. Make sure to use forward slashes for the path separators.
  • -C: Enable compression.
  • -agent: This tells plink to talk to the pageant utility to get the passphrase for the key instead of asking you for it interactively.

You're now ready to use Mercurial with ssh.

Difference compared to previous revision
In addition, these instructions assume that you've generated an SSH key with PuTTY as described at [[Winsshwithputty|Generating and Using an SSH Key on a Microsoft Windows Machine]]. '''Note:''' Thanks to Oliver Reed for his blog [http://buffered.io/2009/05/16/setting-up-trac-mercurial-and-ssh-on-windows Setting up Trac, Mercurial, and SSH on Windows], which was very helpful in writing this page. To use your SSH key with Mercurial, you need to configure it to use the PuTTY tools when using SSH. The Mercurial configuration file you'll use to do this is typically called .hgrc. On Windows it can also be called Mercurial.ini. The file is located in your home folder, for example, C:/Documents and Settings/your-username. If you don’t know what your home folder is, open a command windows and type echo %USERPROFILE% to see the path.
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2013, Oracle Corporation and/or its affiliates
(revision 20140418.2d69abc)
 
 
Close
loading
Please Confirm
Close