Why might GitHub report a public key as invalid?

github, ssh-keys

Solution

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.

Problem

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?

Original source