I just started using Git Bash today and I was trying to create a trial SSH key with git bash so I didn't put any passphrase for it because I thought that I could delete it later and create a new one. how do I remove/ delete this SSH key with no passphrase using Git Bash and how do I check that the SSH key I created is really gone?

I have tried $ rm -f ~/.ssh/id_rsa* but I'm not sure if it really worked.

torek's user avatar

torek

490k69 gold badges743 silver badges870 bronze badges

asked Jul 17, 2021 at 6:50

VinceG's user avatar

VinceGVinceG

771 gold badge2 silver badges10 bronze badges

3

So you probably use ssh-keygen in GitBash. When you used this command, it asked for file where the key should be stored in. By default this is ~/.ssh/id_rsa. You need to delete the specified file (as defined while creating the key) and the associated public key (e.g. id_rsa.pub).

You can inspect the content of the 3 files you have in ~/.ssh with cat ~/.ssh/xyz:

  • If you see something like -----BEGIN RSA PRIVATE KEY-----, it is a private key.
  • If you see something like ssh-rsa ..., it is a public key.

Be careful not to delete something you might still need in the future.


Don't worry too much in case you cannot find the key anymore. Just generate a new key-pair and then update the public key in the places where you had it configured. According to your question you just started to use the old key today, therefore you should still know where this is required.

answered Jul 17, 2021 at 7:20

Matt's user avatar

MattMatt

14k2 gold badges37 silver badges58 bronze badges

3

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.