Invalid ssh public key

Trying to follow github instructions for creating ssh keys for windows.

I ran ssh-keygen -t rsa -C " my@email.com " , enter the passphrase, and it looks like the SSH key is configured correctly.

However, when I try to "Add an SSH key" on GitHub, this gives me an error

Invalid key. It should start with "ssh-rsa" or "ssh-dss". Make sure you copy the public half of the key

The public key created by Windows is as follows:

 ---- BEGIN SSH2 PUBLIC KEY ---- Comment: "2048-bit RSA, my@email.com " *public key* ---- END SSH2 PUBLIC KEY ---- 

First of all, it does not start with 'ssh-rsa' or 'ssh-dss'. I tried to just copy the *public key* and add 'ssh-rsa' to it, but I get the same error on GitHub. Any ideas what I'm doing wrong?

+4
source share
3 answers

Got it. The public key should look like this:

 ssh-rsa *public key* my@email.com 

I.e:

 ssh-rsa<space><public key ending with ==><space><email address> 
+9
source

On Linux, after executing the above command (xyz.pub), the file will be generated in the directory in which you are working. Then, if you make " cat xyz.pub ", you will get your public key, which has "ssh-rsa" at the beginning. This is how it looks like Now you need to copy the pasted text into your GitHub account. Hope this probably solves the problem. And in windows, I think you should edit the file in NotePad ++

+3
source

GitHub generates two files: one without type and one .pub. You will need the second with the extension .pub , this file will already have a template:

ssh-rsa <key> <email>

If it does not have this template, you can look at the wrong file.

+1
source

All Articles