This revision made November 07, 2012 19:15, by nvause
« earlier revision revert to this « later revision

» 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 Reeves (OJ) for his blog Setting up Trac, Mercurial, and SSH on Windows, which was very helpful in writing this page.

To use an SSH key with Mercurial that you've generated with PuTTY tools, you need to configure Mercurial 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 where your home folder is, open a Command window and type echo %USERPROFILE% to see the path.

If you haven’t set up your Mercurial configuration yet, 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 and open it in a text editor.

For example, in Cygwin, you could create the file with the following command:

 ~ cat > .hgrc

Type Ctrl-C to close the file and save it, and then you can reopen it in Notepad to edit 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.

Project Features

Wiki Controls

About this Project

Help for netbeans.org Site Tools was started in November 2009, is owned by kenaiadmin, and has 17 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close