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 an otherwise pristine Windows 7 Enterprise install:

  1. Install PuTTY 0.62
  2. Create public/private key pair with puttygen.exe
  3. Add public key for pasting into OpenSSH authorized_keys to github account
  4. Add private key to pageant
  5. Install msysgit 1.7.8 with the following options:
    • Use Git from Windows Command Prompt
    • Use (Tortoise)Plink pointed to correct plink.exe
  6. Make sure github fingerprint is added to know_hosts by connecting to github.com in PuTTY and accepting fingerprint
  7. Edit ~/.ssh/config to read:

    Host github.com
        User git
        Hostname github.com
        PreferredAuthentications publickey
        IdentityFile ~\.ssh\github.ppk
    

ssh -vvvT git@github.com gives: http://pastebin.com/Tu3Fc6nJ. Note that I'm being prompted for the pass-phrase despite it being successfully loaded into pageant.

I've tried: chmod 700 ~/.ssh; chmod 600 ~/.ssh/* from within Git Bash but there was no effect as verified by ls -l.

I should note that I had this exact setup working on a previous Windows 7 install. Everything is identical as far as I can tell.

What does work is generating keys from within Git Bash. However, I cannot add those keys into pageant, which is a huge pain. In effect, it seems that any attempt to use keys generated by PuTTY is unsucessful.

Any insight on what's preventing this from working based on the logs? Thanks in advance.

share|improve this question
    
with -vT, please, less verbosity level –  Lazy Badger Jan 14 '12 at 16:30

2 Answers 2

up vote 11 down vote accepted

You are confusing two entirely separate programs: PuTTY and OpenSSH.

  • plink and Pageant are part of PuTTY. The ssh command is part of OpenSSH. It is unclear which program is being used by Git; you need to check the %GIT_SSH% environment variable for that.

  • The programs use different agent protocols; OpenSSH cannot use PuTTY's Pageant; it has its own ssh-agent (which unfortunately is somewhat complicated to use on Windows).

  • PuTTY and plink store the session settings in registry, editable in PuTTY's interface. They do not use anything in ~/.ssh/; this directory is only used by OpenSSH.

  • The private key formats used by OpenSSH and PuTTY are different; you cannot use a .ppk key with OpenSSH. If you generated the key in PuTTYgen, you have to use its "Export → OpenSSH" command.

    $ ssh -vvvT git@github.com
    OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
    ...
    debug2: key_type_from_name: unknown key type 'PuTTY-User-Key-File-2:'
    
share|improve this answer
    
I am aware of the difference and as indicated in the original post, git has been set to use plink when installed. I have verified that this has changed the proper environment variable to point to plink.exe. I'd like to use PuTTY keys (and this has worked in the past!) with git, and the fact that its not working despite plink being used is weird... –  Radu Jan 15 '12 at 20:46
    
Essentially, right now I can get it to work with OpenSSH keys, but not with PuTTY keys. I have tried reinstalling PuTTY and also generating new keys. TThat doesn't seem to be problem. Any idea what it could be? –  Radu Jan 15 '12 at 20:48
1  
@Radu: plink does not support OpenSSH key format. If your version does, then it's not plink you are using; it's something else. –  grawity Jan 15 '12 at 20:56
1  
@Radu: Also, the original post indicates the opposite of your claim. First you generate a key with PuTTYgen and load it to Pageant, but then you go with configuring OpenSSH and complain that "ssh prompts for pass-phrase despite being loaded into Pageant". You are confusing the two programs. –  grawity Jan 15 '12 at 21:53
    
I never said that plink supports OpenSSH - Git Bash, however, does, since by default it uses OpenSSH. Reading back, you are correct, I have been confusing things since as you said, ~/.ssh/config is not used by PuTTY. However, I'd like to reiterate that GIT_SSH is pointed to plink, and yet if I modify the ssh config file for OpenSSH the changes are reflected in Git Bash when attempting to connect to github. Essentially, I believe that the GIT_SSH environment variable is being ignored and I suppose it's something specific to my OS. I'll try on a fresh image tomorrow. –  Radu Jan 16 '12 at 5:49

In plain English

debug3: Not a RSA1 key file /c/Users/Radu/\.ssh\github.ppk.

debug2: key_type_from_name: unknown key type 'PuTTY-User-Key-File-2

Puttygen can build different of keys, Github wants SSH1-RSA (?, I use ssh2 keys with Pageant on github)

Adds

See also this post about debugging pageant issues with Github

>plink.exe -v -agent git@github.com
Looking up host "github.com"
Connecting to 207.97.227.239 port 22
Server version: SSH-2.0-OpenSSH_5.1p1 Debian-5github2
Using SSH protocol version 2
We claim version: SSH-2.0-PuTTY_Release_0.62
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-256
Host key fingerprint is:
ssh-rsa 2048 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Pageant is running. Requesting keys.
Pageant has 1 SSH-2 keys
Using username "git".
Trying Pageant key #0
Remote debug message: Forced command: gerve lazybadger
Remote debug message: Port forwarding disabled.
Remote debug message: X11 forwarding disabled.
Remote debug message: Agent forwarding disabled.
Remote debug message: Pty allocation disabled.
Authenticating with public key "github/lazybadger" from agent
Sending Pageant's response
Remote debug message: Forced command: gerve lazybadger
Remote debug message: Port forwarding disabled.
Remote debug message: X11 forwarding disabled.
Remote debug message: Agent forwarding disabled.
Remote debug message: Pty allocation disabled.
Access granted
Opened channel for session
Server refused to allocate pty
Started a shell/command
Hi lazybadger! You've successfully authenticated, but GitHub does not provide shell access.
Server sent command exit status 1
Disconnected: All channels closed
share|improve this answer
    
SSH1 is obsolete and has numerous security holes. Github does not use it. –  grawity Jan 14 '12 at 16:43
    
This equivalent to 'ssh -T git@github.com' is sadly missing from the github howto documentation. Thank you for posting. –  Epu Nov 16 '12 at 17:35

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.