Why might GitHub report a public key as invalid?
12,069
Solution 1
The Problems
- The ssh-keygen utility usually defaults to generating RSA keys, but your implementation may default to ECDSA, which GitHub does not currently support.
- If you are truly generating RSA keys, you may be trying to paste your private key to the server, instead of your public key.
Solutions
- Force RSA key generation by passing the -t flag to ssh-keygen.
- Make sure you're copying the key with a .pub extension, and that you include the entire line. This will include the ssh-rsa prefix if you're copying an RSA public key.
Related
Of course, man 1 ssh-keygen
is your friend.
Solution 2
You should add the "hexa decimal part" and put "ssh-rsa " in the front, that should do the trick.
Author by
Rajani
Updated on June 04, 2022Comments
-
Rajani almost 2 years
I have generated ssh key.
The result was:Your identification has been saved in /home/rajani/.ssh/id_rsa. Your public key has been saved in /home/rajani/.ssh/id_rsa.pub.
The key is in hexa decimal format, but while adding it to GitHub, I am getting error like this:
Key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key .
How I should properly add an ssh key to GitHub?