Step 1: Generating SSH Key

1.From the command line, enter ssh-keygen. (if you get an error in the command window, check if C:\Program Files\Git\usr\bin is part of your path) The command prompts you for a file to save the key in

  1. Press enter to accept the default key and path, /c/Users//.ssh/id_rsa.

  2. Enter and re-enter a passphrase when prompted.

  3. The command creates your default identity with its public and private keys.

2.Configuring tortoise-git

  1. Load the ssh key generated previously(id_rsa). it will prompt you to select the file. (default path of the ssh keys C:\Users\.ssh)

  2. While loading it will ask for passphrase.. enter the passphrase that was given earlier. After this step putty will load the certificate.

  3. Once the certificate is loaded, click on the 'Save private key' button. it will prompt for picking the folder in which the file to be saved. Better to keep it in the same one as ssh key folder (C:\Users\.ssh). specify the filename also.

  4. Now you have to configure the TortoiseGit with the generated key file. right click on the repo folder select TortoiseGit>Settings

  5. In the settings screen select Git > Remote

  6. In remote screen, select origin.. it will populate the URL and other fields.

  7. Click on the ellipses against the Putty Key field and select the private key file that was generated with puttygen.

The file format of the private key is



----END RSA PRIVATE KEY------- enter image description here


The error was

Couldn't load private key(unable to open file)

enter image description here The file has read-write permission. Apart from this private key has a passphrase, I think it would be the reason for the error.

The public key configuration in my bitbucket account, Public key setting

  • By "I had generated a private key in puttygen" - do you mean that you have converted the key from PEM format to PPK? Mar 6, 2018 at 8:55
  • Yeah, I converted it to .ppk file.
    – kvk30
    Mar 6, 2018 at 8:56
  • Well, so edit your question to make that clear. Your current wording is nonsense. Mar 6, 2018 at 8:59
  • Explain how did you convert the key. + Show us how does the converted .ppk file look like + "The error was" - What error? When do you get that error? + Mar 6, 2018 at 9:00
  • Attached screenshots and steps what I had followed to configure git and generating keys.
    – kvk30
    Mar 6, 2018 at 9:10

4 Answers 4


The thing is your PuTTy uses ssh v2 (and it's good) but you key is generated for version 3 probably.

Here the steps to verify: enter image description here

enter image description here

After you click OK, generate a new key and try to upload it. Worked for me.

  • If the version were the problem, the error would say "Couldn't load private key (PuTTY key format too new)", not "Couldn't load private key (unable to open file)", what this question is about. Jul 15, 2021 at 8:45
  • The "format too new" problem was exactly what I ran into, so luckily this did help in that case. Aug 30, 2021 at 15:14

If I understand you correctly, you didn't use puttygen to create a keypair, instead, you used ssh-keygen to generate a keypair with passphrase, then you loaded that private key into Putty and saved it as Putty.ppk and got the error Couldn't load Private Key (cannot open file).

What format was the private key (id_rsa) you created in?

If you open it in a text file is the first like similar to this:


or does it look like this:

ssh-rsa AWEdxRASFLMAF......

This appears to be, likely, an issue with you loading the public key instead of the private key to save as a .ppk. The screenshot you show has 2 files: id_rsa and id_rsa, but one of them is the private key file and the other is the public key. It's probable that you selected the public key if no file extensions were shown. Try re-importing the key by selecting the id_rsa file with the timestamp of 05-03-2018 12:36 in your screenshot above.

Verify the first line in that file is


before you do.

  • have you uploaded your public key to your remote git repository yet? Apr 3, 2018 at 19:03
  • I had set public key for my bitbucket account still same error no change in the error message.
    – kvk30
    Apr 4, 2018 at 6:29
  • your screenshots are changing as is the value of the key in the putty key field. This is very confusing. What happened if you run the git push command outside of tortoise, does it work or do you get an error? whats the value of Settings - TortoiseGit >> Network >> SSH-Client? you originally appeared to state that you generated a keypaid (id_rsa / id_rsa.pub) . imported it into putty by converting it to putty.ppk . and were having trouble reading the key, which you had then set up in tortoise. now you are showing you are using id_rsa as the key in tortoise. Apr 4, 2018 at 13:41
  • My screenshots are updated to give clarity, I tried as mentioned in comments. To ensure my trying, I am updating screenshots. By command-line, I am not getting an error. You mentioned in your answer that private key has some format, which is id_rsa, so updated key to id_rsa from putty.gen. Sorry for making you confused, I am unable to show the root cause or problem. Showing my whole procedure for clarity.
    – kvk30
    Apr 5, 2018 at 5:23
  • it looks like you changed the key that tortoise is using from putty.ppk to id_rsa. id_rsa is the private key ssh key-gen created. it should be the key you converted to putty.ppk after importing with puttygen. putty.ppk is what you should play in the key field in tortoise git. Apr 5, 2018 at 15:09

I had this same message, and for me the problem was that I had two versions of putty. I am using git extensions, which can be installed to include putty (it is the 32 bit version of putty, and located in the git extensions program files directory). I also installed putty myself.

I had generated the key with the 64 bit putty installation, and was trying to use that key with the 32 bit version. I fixed the issue by changing my putty path in git extensions options.

picture of git extensions settings window to specify location of putty

  • It cannot be 32-bit vs 64-bit. It must be because your 32-bit and 64-bit installation are different versions – What is already covered in the answer by @Denis. And as with his answer, it actually does not answer this question, which is about "unable to open file", not "PuTTY key format too new" Aug 31, 2021 at 17:17

In one version of puttygen I had the exact same error message ("unexpected end of file"). In the latest (0.76), puttygen just hung indefinitely trying to import my key, and I had to kill the process.

Since I couldn't find any answers that helped me and I'm a C++ developer, I decided to debug puttygen since the source code is available (using 0.76).

The problem for me was that somehow at the end of my private key there was an extra space, and puttygen cannot handle that!

So, instead of the last line of my private key file ending with


it ended with

"-----END RSA PRIVATE KEY----- "

Puttygen is programmed to keep on scanning for more key information from the file until it finds a line that starts with "-----END " and ends with "PRIVATE KEY-----", and it doesn't handle EOF (end of file) properly at all!

I hope this helps somebody, this issue drove me nuts!

  • 4
    There's no "unexpected end of file" mentioned anywhere in this question. So what "exact same error message" are you referring to? Sep 15, 2021 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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