FGreg FGreg - 1 month ago 18
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:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "2048-bit RSA, my@email.com"
*public key*
---- END SSH2 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

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>
Comments