Not a private key


i am trying to import a private key into travis using the ui under setting. I generated the key using the following command:

ssh-keygen -t rsa -b 4096 -m PEM

but when i copied and pasted the text from the private key file, it’s complaining that the key is not a private key. I have no pass phrase on the key.

Try running:

openssl rsa -in id_rsa -outform pem > id_rsa.pem

See if that works.

Thanks Montana, but that didn’t work either. It actually produced the same file as the original private key file.

Interesting, how about?

ssh-keygen -p -m PEM -f ~/.ssh/id_rsa

Sorry about having you try various commands, this has definitely peaked my interest.

No problem. I actually got it to work. I just went to an online generator (Online Generate SSH keys algorithm RSA,DSA,ECDSA) and that gave me keys that I was able to upload to both github and travis. Not sure if it’s the mac version of ssh-keygen or something. But now I am trying to solve my other issue. Which is deploying docker image and within it there is private repo in the package.json. I am hoping the ssh key will work since the error I was getting was from:

npm ERR! command git ls-remote ssh://[secure]/react-awesome-query-builder.git

Great news @billtlee,

I’ll head on over and take a look at that now!

Need reproduction steps to diagnose the issue.
The ones provided in the head message are insufficient – there’s no mention of:

  • how and where from and to the OP copypastes the key; and
  • what exact sequence of steps produces the error, and the exact error

My best theory is there’s an EOL type mismatch at some point or extraneous characters from the used method of copypasting.

Most likely the number of bits in the key -b 4096 was too large for our algorithm to cope.