Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid public ssh key

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

I run ssh-keygen -t rsa -C "[email protected]", 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, [email protected]"
*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?

like image 437
FGreg Avatar asked May 08 '26 14:05

FGreg


1 Answers

Got it. The public key should look like this:

ssh-rsa *public key* [email protected]

That is:

ssh-rsa<space><public key ending with ==><space><email address>
like image 64
FGreg Avatar answered May 11 '26 09:05

FGreg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!