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
Just for those looking in the future, another common issue is that word-wrapping. For example, if you run cat ~/.ssh/id_rsa.pub
it could wrap lines, thus adding extra \
characters at each line break. Remove these and your key should work fine.
If you have indeed copied the content of your id_rsa.pub
key (in one continuous line), the result should look like (from The GitHub ssh help page):
The OP louism confirms a copy-paste issue:
- For a very obscure reason, copy-pasting from emacs removed the
\n
after ssh-rsa, and that was causing the problem.- Copy-pasting from vi solved the problem.
Here are some steps that are not at all clear when copy/pasting your public key. (For the record, I used Putty Key Generator for my keys.)
Notice on this screenshot, there's a space after ssh-rsa (See the cursor.) The public key text also includes three \n characters, so you can see the public key text bumps down to the next line three times in the textbox.
if using vs code
code ~/.ssh/id_rsa.pub
will open .pub
file copy it to github
I just had this issue. Super frustrating. I figured my situation might have affected the casue of the problem. I am using a tablet, trying to setup the key on githubs site through my tablet browser (Chrome) and I am copying the key from an ssh app connected to my remote linux server.
What ended up happening is that somehow when I copied the key to the browser, it introduced a number of line breaks. Not only that, but it also removed a character from each point where a new line was inserted.
So to get it to work, I had to manually find each new line break, then hunt for that part of the key to find the missing character. I then added the character and removed the new line. After I hunted down each and every change, the key worked fine.
By the way, I did not add any new line breaks myself, such as the one mentioned by others after the ssh-rsa.
Hopefully this helps others. I have no idea why it happened. Silly that copying to the clipboard would alter the text copied. Oh, I also copied it right out of Vim.
In my case, I had to add an extra white rule after my e-mail (after the entire key string) before it got accepted. I found this out by accident, after trying to copy my ssh key as entered on Gitlab.
pbcopy from my pub key straight form the command line didn't work. The copy from gitlab with the extra white rule at the end, did the trick.