githubssh-keysssh-keygen

Can't add a new public key via SSH (GITHUB)


I am trying to create a new public key via SSH on GitHub.

> code > SSH > copy > add new public key

The next window is SSH keys / Add new.

I type in a title, then copy and paste the previously copied text. Then here is the problem.

**The copied text does not begin with SSH-RSA OR ECDSA OR SSH-ED OR SK-ECDSA OR SH-SSH which is required to add the SSH key. The only text I can copy from the SSH tab is very short and beginning with git@github.com...etc **

The error message I get having clicked add SSH key - Key is invalid. You must supply a key in OpenSSH public key format

Any help appreciated.

Not sure how to overcome the problem as my colleagues accounts all display SSH-RSA OR ECDSA OR SSH-ED OR SK-ECDSA OR SH-SSH text.


Solution

  • This message indicates you should paste your public key with type of key as prefix. For example, let's say the hash of your public key is AAAA.......AAIK0 it should be prefixed by ssh-rsa AAAA.......AAIK0 if your key is rsa or ssh-ed25519 AAAA.......AAIK0 if it is an ed25519 key.