Search code examples
windowsputtyprivate-keygit-bash

"Couldn't load private key (not a private key)" when converting id_rsa.pub to ppk using PuTTYgen


I'm installing Git 2.5.0 (included with latest docker-toolbox) on my Windows 7 64-bit.

I try to regenerate new key using git-bash:

ssh-keygen -t rsa

and save the new key to specific location. When trying to convert using PuTTYgen to .ppk file there's error:

Couldn't load private key (not a private key)

Is there something wrong with my Git version?

Here's the .pub file:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4YN/jejgFKubJ7YBUdl18EKuxFcC2CS/Rl19u6giHIz6zP548guM22Vm1edOLHN6qh2tpJkbzN6FOtLrCUXQqQ4unBqPlAY0dU4Cvzh86TDqdWixOV3AuBGJAMmjrrGe/U3/yO1RgR1pARrl7ZpY7ma7tP/9o8rGDmbQclIULNcI5AYCjRLICgbDlawT8jRYBT33VztphLi9HzGgDtSPANGJpgRrnYcoF3ZJL4E/CC7SW33lz2S/cLsupDdjusPWJjzR8vDKCXYtBTjvNP+a5GY21Z7eQHwD0MBFdxyHCMM0rnVWMJFmNNYy0N2ho5TrJ7kUHbzz4tUfrGPdWzOqX dxx@dxx-SandBox

Solution

  • You are obviously loading a public key to the PuTTYgen, not the private key.


    The ssh-keygen -t rsa generates two files:

    • The key pair id_rsa (containing both the public key and the private key):

      -----BEGIN RSA PRIVATE KEY-----
      ...
      -----END RSA PRIVATE KEY-----
      
    • The public key id_rsa.pub:

      ssh-rsa ... comment
      

    You cannot load the id_rsa.pub to PuTTYgen. It makes no sense, as the file does not contain the private key.

    You have to load the id_rsa.