Unable to add ssh keys again

Cleaning up my ssh keys, I accidentally removed one of my public keys, now when I try to add it again it fails with:

SSH key already in use.

How is that possible? How can I clean it up correctly and add them again?

That means the SSH key is already in use on an account in GitHub.
Do you have any existing SSH keys on your account displayed on page https://github.com/settings/keys

The following command (you will need to insert a personal access token for your account in it), displays the public SSH keys on your account
curl --location --request GET “https://api.github.com/user/keys” --header “Authorization: token INSERT-TOKEN-HERE”
the output includes a field “key”: with the text value of your public key(s) configured in your GitHub.

If you have used multiple GitHub user accounts, the public keys must be unique across GitHub, by that I mean you cannot use the same public SSH key on another user.

I know, but the main issue is that the sig for the key is not under the settings/keys page. for example in my .ssh directory I have:

  • id_master
  • id_ed25519
  • id_rsa
  • id_github_actions

All this keys at some point had been part of the my authorized keys, but at some point I added a 5th one, one related to my yubikey and remove all of the existing ones except id_github_actions.pub.

Now that my yubikey is broken and I need to add id_rsa.pub back to be able to push to my enabled sso organization, and it says it can be added because is already there.

When I do:

curl \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/users/jycr753/keys

I do get the yubikey public ssh key and the github_actions one too, which is right information being displayed in the gui.

Any ideas?

Does that mean if I enabled for SSO and remove it with out disable it first I am out of luck?

I am finding it hard to understand exactly your question and problem is, remember i cannot see what you are seeing or what responses you are getting and don’t have the full background.
I am guessing now a little but have provided some details below about local SSH keys, fingerprints and how to compare against this added to your GitHub account.

The GitHub GUI https://github.com/settings/keys does not show the actual public key once added, it does display its fingerprint (SHA256: blahblah…)
on you local machine .ssh folder use this command to get the fingerprint or a local SSH keys, e.g.

ssh-keygen -l -f id_ed25519.pub
You can compare this value against the fingerprint values listed in https://github.com/settings/keys

On…

Does that mean if I enabled for SSO and remove it with out disable it first I am out of luck?

Sorry, I don’t know wat you mean by this question. But enabling/disabling organization SSO does not impact you SSH keys other than you having to specifically enbale an SSH Keys for use with a SAML SSO configured organization, which you may already be aware of if you have used SAML SSO configured organizations.

Hope the above helps, if not we can try again, but will need some more exact information on the problem.

Good luck