bashssh

How do I delete my SSH Key from my windows 10 computer using Git Bash?


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.


Solution

  • 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:

    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.