Active2 years, 4 months ago
I was having the exact same problem. When you installed Git, did you select the option 'run Git from the Windows command prompt'? If not, try re-installing and make sure you select that option.
Trying to follow the instructions on github for Generating SSH Keys for windows.
I run
ssh-keygen -t rsa -C '[email protected]'
, enter passphrase and it appears the SSH key is generated correctly.However, when trying to 'Add SSH Key' on GitHub it gives me the error
Key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key
The public key generated by Windows looks like this:
Most notably it does not begin with 'ssh-rsa' or 'ssh-dss'. I tried just copying the
FGregFGreg*public key*
part and prepending 'ssh-rsa' to it but I get the same error on GitHub. Any ideas what I'm doing wrong?6,4097 gold badges46 silver badges90 bronze badges
3 Answers
Got it. The public key should look like this:
That is:
FGregFGreg6,4097 gold badges46 silver badges90 bronze badges
In Linux,after executing the above command,(xyz.pub) file will be generated in the directory you are working on. Then if you do a ' cat xyz.pub ', you will get your public key which has 'ssh-rsa' in the beginning. Now,you need to copy paste the displayed text in your GitHub Account. Hope this will probably solve the issue.And in windows,I think you should edit the file in NotePad++
m0rpheu5m0rpheu5
GitHub generates two files: one with no type, and one .pub. You need the second one with the
.pub
extension, that file will already have the pattern:ssh-rsa <key> <email>
If it doesn't have this pattern, you may be looking at the wrong file.
![Ssh Ssh](/uploads/1/2/5/4/125499324/745293547.gif)
2,6402 gold badges26 silver badges38 bronze badges
Not the answer you're looking for? Browse other questions tagged windowsgitgithubssh or ask your own question.
Active4 months ago
When I import my OpenSSH public key into AWS EC2's keyring the fingerprint that AWS shows doesn't match what I see from:
It is a different length and has different bytes.
Why? I'm sure I uploaded the correct key.
Craig RingerCraig Ringer7,0986 gold badges28 silver badges50 bronze badges
8 Answers
AWS EC2 shows the SSH2 fingerprint, not the OpenSSH fingerprint everyone expects. It doesn't say this in the UI.
It also shows two completely different kinds of fingerprints depending on whether the key was generated on AWS and downloaded, or whether you uploaded your own public key.
Fingerprints generated with
will not match what EC2 shows. You can either use the AWS API tools to generate a fingerprint with the
ec2-fingerprint-key
command, or use OpenSSL to do it.Note that if you originally generated a key on AWS, but then uploaded it again (say, to another region) then you'll get a different fingerprint because it'll take the SSH2 RSA fingerprint, rather than the sha1 it shows for keys you generated on AWS.
Fun, hey?
In the above,
test-generated
was generated using AWS EC2. test-generated-reuploaded
is the public key from the private key AWS generated, extracted with ssh-keygen -y
and uploaded again. The third key, test-uploaded
, is a locally generated key .. but the local ssh-keygen -l
fingerprint is b2:2c:86:d6:1e:58:c0:b0:15:97:ab:9b:93:e7:4e:ea
.Keys generated locally
You can use OpenSSL, as demonstrated by Daniel on the AWS forums, to generate the fingerprint in the form used by AWS to show fingerprints for uploaded public keys (SSH2 MD5), like:
They can be generated by extracting the public part from the private key and hashing it using:
Keys generated on AWS
If the key fingerprint shown on the AWS console is longer then it was a private key generated on AWS, like:
In this case you need to use the following command, also shown by Daniel on the AWS forums, to generate a sha1 hash based on the private key:
on the downloaded AWS-generated private key/certificate file. It'll work on keys you converted to OpenSSH format too.
References
See:
Community♦
Craig RingerCraig Ringer7,0986 gold badges28 silver badges50 bronze badges
If you only have public keys, you can generate the AWS fingerprint as follows:
techraf3,4638 gold badges18 silver badges40 bronze badges
J. DoeJ. Doe
There's a resource on AWS docs http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#verify-key-pair-fingerprints
If you created your key pair using AWS, you can use the OpenSSL tools to generate a fingerprint from the private key file:
Copy
If you created your key pair using a third-party tool and uploaded the public key to AWS, you can use the OpenSSL tools to generate a fingerprint from the private key file on your local machine:
Copy
The output should match the fingerprint that's displayed in the console.
gouthamgoutham
This is what I use:
This generates the fingerprint from the public key, similar to some of the above.
Max MurphyMax Murphy
AndyAndy
Here is a script that I use, add the script path to env.Thanks to J.Doe for the answer
Sand1512Sand1512
Just in case this could be useful: https://ssh-vault.com/post/fingerprint/
for example:
Will print the fingerprint for user bob matching the format AWS is using.
nbariSsh Keygen Download Windows
nbari2671 gold badge3 silver badges18 bronze badges
Ssh-keygen Is Not Recognized As An Internal Or External Command
Java (using BouncyCastle). If the AWS console displays shorter keys, try with MD5. (SHA1: 20 bytes, MD5: 16 bytes).
Reto HöhenerReto Höhener2862 gold badges5 silver badges13 bronze badges