Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

[ui]
username = John Doe <jdoe@example.com>
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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.