I have generated SSH keys for a new server installation according to the procedure outlined here. However, when I copy the contents of id_rsa.pub
to my keys list on GitHub, I get the error message "Key is invalid. Ensure you've copied the file correctly."
The generated key is valid, and I am copying it exactly as is (all in one line with no whitespace at the beginning/end).
Anybody have an idea what could be going on?
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.