36

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

1
  • Ugh, using SourceTree 4.2.5 to generate an ssh key (using the handy "Generate Key" button in the Accounts modal) and connect to github (sourcetree even uploaded the key for me) yields this error.
    – jwallis
    Commented Nov 1, 2023 at 20:46

5 Answers 5

62

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 "[email protected]"

Original answer with details can be found here

4
  • 7
    Thanks, but what about an RSA which is not SHA-1? Is that possible? The ECDSA worked.
    – gene b.
    Commented Mar 17, 2022 at 14:27
  • 1
    I second this question -- need an RSA key for OpsWorks, which seems to not accept anything else.
    – dvanhook
    Commented Apr 28, 2022 at 18:47
  • Works with cpanel ( terminal ), Thanks Commented May 17, 2022 at 18:55
  • 4
    or simply ssh-keygen -t ecdsa
    – x-yuri
    Commented Jan 17, 2023 at 15:14
12

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.

4
  • 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 stackoverflow.com/a/68802292/6505250
    – howlger
    Commented Mar 16, 2022 at 22:54
  • 1
    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: stackoverflow.com/questions/71489256/…
    – gene b.
    Commented Mar 17, 2022 at 2: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.
    Commented Mar 17, 2022 at 2:22
  • 1
    As of March 15, 2022, GitHub no longer accepts newly uploaded RSA keys with SHA-1: github.blog/2021-09-01-improving-git-protocol-security-github
    – howlger
    Commented Mar 17, 2022 at 8:19
2

you can follow this steps To solve this problem :

in your terminal type this command ssh-keygen -t ecdsa -b 521 -C "[email protected]" 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

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

1
  • 2
    I updated my answer to mention deleting the old key first.
    – gene b.
    Commented Mar 18, 2022 at 13:27
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 "[email protected]"

More Details Follow GitHub Docs : Generate new SSH key

Not the answer you're looking for? Browse other questions tagged or ask your own question.