Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Windows 7, my .hgrc config file provides a nice an easy way to tell Mercurial about the private SSH key location with the following syntax:

username = John Doe <>
ssh = plink.exe -i "C:\Users\jdoe\mykeys.ppk" 

Does anyone knows what is the equivalent syntax for the .gitconfig file? All I can find so far is the GIT_SSH environment variable that does not seem to let me specify the private key location.

share|improve this question
Is the key used for all SSH connections, or must it limited to hg/git? – grawity Aug 11 '11 at 18:44
All connections is just fine. – Joannes Vermorel Aug 12 '11 at 9:18
up vote 1 down vote accepted

If you want to specify a key to be used for all connections, there are two ways to do it with PuTTY:

  1. Load the key into Pageant, the SSH agent program. Just double-click the .ppk file and enter its passphrase, if any.

    This has several advantages: you can encrypt the key on disk and still retain the convenience of password-less logins, and you can have multiple keys loaded and they all will be tried.

    (The OpenSSH equivalent of Pageant is ssh-agent, by the way.)

  2. Edit PuTTY's default configuration to point to the key. Open a new PuTTY window, go to Connection → SSH → Auth, and choose your key file under Private key file. Go back to Session, click the "Default Settings" item, and click Save.

    plink uses the same session settings as PuTTY, and will automatically use the key you configured here.

    (In OpenSSH, you would edit ~/.ssh/config to achieve the same result.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .