27

I created a public key in Git using ssh-keygen which was successfully created as .ssh/id_rsa.pub.

enter image description here

I then uploaded it to GitHub in my SSH Keys, and "Authorized" its SSO feature. Everything is uploaded now.

enter image description here

When cloning a repository in Eclipse, I get the following message enter image description here

gene b.
  • 10,512
  • 21
  • 115
  • 227

5 Answers5

49

According to Github security blog RSA keys with SHA-1 are no longer accepted.

Use the following command to create new SSH key with ECDSAencryption and add it to Github.

ssh-keygen -t ecdsa -b 521 -C "your_email@example.com"

Original answer with details can be found here

You Qi
  • 8,353
  • 8
  • 50
  • 68
Haseeb Iqbal
  • 1,455
  • 13
  • 20
9

I had to generate an ECDSA key, not an RSA key. Not sure why, but none of the RSA options worked for me, including the default.

ssh-keygen -t ecdsa -b 256 -m PEM

I got this from https://stackoverflow.com/a/71502531/1005607

Then I uploaded it to GitHub (after deleting my old key first), updated my Eclipse SSH2 private key to point to id_ecdsa. Now I can clone repositories.

gene b.
  • 10,512
  • 21
  • 115
  • 227
  • In Eclipse you can create an SSH key which will work with GitHub in the preferences _General > Network Connections > SSH2_ tab _Key Management_ by hitting the _Generate RSA Key..._ button. See https://stackoverflow.com/a/68802292/6505250 – howlger Mar 16 '22 at 22:54
  • Yes, I tried that and it **didn't work**. None of the RSA options, including Eclipse-generated ones, worked. Only the ECDSA one did. They must have changed something recently in Git. Actually, just yesterday someone posted a similar question, and this is where I got the answer from: https://stackoverflow.com/questions/71489256/spring-cloud-config-server-github-sha-1-error/ – gene b. Mar 17 '22 at 02:14
  • The responder in that thread noted, " *all* RSA keys get the same error about SHA-1 signing" -- so he had to go with something different entirely (ECDSA). – gene b. Mar 17 '22 at 02:22
  • 1
    As of March 15, 2022, GitHub no longer accepts newly uploaded RSA keys with SHA-1: https://github.blog/2021-09-01-improving-git-protocol-security-github/ – howlger Mar 17 '22 at 08:19
2

you can follow this steps To solve this problem :

in your terminal type this command ssh-keygen -t ecdsa -b 521 -C "your_email@example.com" you will be ask:

-"enter file in which To save the key" click enter

-enter passphrase (empty for no passphrase) click enter again

  • enter same passphrase again click enter

you will a message "your public key vas been saved in /user/machine/.ssh/id_ecdsa.pub(just an example ).

-type cat (where the file was save in my case /user/machine/.ssh/id_ecdsa.pub) To see your new generate ecdsa key .copy and go to github create a new ssh (dont forget to remove the old one ) and paste it then save

in your terminal again type ssh-add (directory of your new created id_ecdsa) to add it to the list. you will see identity added : directory of your key

hope this was helpful

0

GitHub improved security by dropping older, insecure key types on March 15, 2022.

Paste the text below in your terminal and substituting in your GitHub email address.

$ ssh-keygen -t ed25519 -C "your_email@example.com"

More Details Follow GitHub Docs : Generate new SSH key

Sanaulla
  • 1,329
  • 14
  • 13
-1

Small remark I had to first delete old key from my github account. I am not sure if it was just some coincidence.