FGreg FGreg - 1 year ago 148
Git Question

Invalid public ssh key

Trying to follow the instructions on github for Generating SSH Keys for windows.

I run

ssh-keygen -t rsa -C "my@email.com"
, enter passphrase and it appears the SSH key is generated correctly.

However, when trying to "Add SSH Key" on GitHub it gives me the error

Key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key

The public key generated by Windows looks like this:

Comment: "2048-bit RSA, my@email.com"
*public key*

Most notably it does not begin with 'ssh-rsa' or 'ssh-dss'. I tried just copying the
*public key*
part and prepending 'ssh-rsa' to it but I get the same error on GitHub. Any ideas what I'm doing wrong?

Answer Source

Got it. The public key should look like this:

ssh-rsa *public key* my@email.com

That is:

ssh-rsa<space><public key ending with ==><space><email address>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download