Skip to content

Authentication failed - How can I clear and re-add SSH #64661

Closed Answered by nirav-gajera
jordankeen asked this question in General
Discussion options

You must be logged in to vote

To clear all in your host file and all SSH keys, you can follow these steps:

  1. Open a terminal window.
  2. Run the following command to clear your host file:
sudo rm -f ~/.ssh/known_hosts
  1. Run the following command to clear all SSH keys:
ssh-keygen -f ~/.ssh/id_rsa -e

This will delete all SSH keys that are stored in your ~/.ssh directory.

-To re-add your SSH key to GitHub:

  1. Open a terminal window.
  2. Run the following command to generate a new SSH key:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

This will create a new SSH key pair in your ~/.ssh directory. The default filename for the private key is id_rsa and the default filename for the public key is id_rsa.pub.

  1. When prompted,…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@bronglil
Comment options

Comment options

You must be logged in to vote
1 reply
@jordankeen
Comment options

Answer selected by jordankeen
Comment options

You must be logged in to vote
1 reply
@benrich37
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants