How do I restore a previous version of my ssh keypair files?

I was following the Github tutorial and I generated a new SSH key pair. But now when I'm online, Google keeps throwing up SSL errors (and so does everywhere else with SSL, for that matter). What terminal commands do I need to input in order to return to my original SSH key pair?


Note: I actually think your browser SSL errors are not at all related to the fact that your generated a new keypair for ssh use in your ~/.ssh directory. Browsers don't use these keys, only ssh uses these keys (and things that are based around libssh).

But if you want to restore the previous version of your keypair here are the two ways you can do it....

Assuming you followed step 2 in that github document, you can just restore your backed-up keys:

cd ~/.ssh
rm id_rsa*
cp key_backup/* .

That will delete the new keys you created and then restore your old keys.

If you didn't backup your original keys according to that document you can try to use Time Machine to find the previous version of your keys and restore them.

First open a Finder window and then hit Cmd-Shift-G to bring up the Go To box. In the box type: ~/.ssh and press the Go button.

Go To ~/.ssh

Switch to column view so you can see the details of the files in the ~/.ssh directory and note the Date Modified time on the id_rsa and id_rsa.pub files.

Switch to column view so you can see the Date Modified meta-data on the files

Now enter Time Machine by clicking on the Time Machine icon in the upper right hand corner of the menu bar and selecting 'Enter Time Machine':

Enter Time Machine

Step backwards in time until you find the point where Date Modified time stamps on those two files change. That should be the previous version of those files. Select the id_rsa and id_rsa.pub files from this point in time and restore them overtop of the existing files.