5

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.
  • 8,520
  • 12
  • 76
  • 167

4 Answers4

6

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

Haseeb Iqbal
  • 757
  • 7
  • 17
2

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.
  • 8,520
  • 12
  • 76
  • 167
  • 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
1

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

-1

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

  • I updated my answer to mention deleting the old key first. – gene b. Mar 18 '22 at 13:27
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 19 '22 at 13:01