“Key is invalid” message on GitHub

I came here because I had the same problem. From your question, I realized that I was copying the contents from the wrong file, without the .pub extension (it was my private key, i.e. the id_rsa file, which should be kept private at all times!)

From a MAC:

vi ~/.ssh/id_rsa.pub

Copy exactly from the end (with be the last letter of your email domain extension) of the block of characters to the beginning, which starts with ssh-rs …

If it doesn’t work, you are surely not copying properly.

It worked.

If you are on Windows, use notepad and copy-paste as described above.

I hope that helped.

Leave a Comment