Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need old SSH keys if I migrate to a new computer to use Git?

I am migrating all my work to a new computer. I seem to remember having once - ages ago - generated an SSH key for Git / Github. Where is this key stored? Do I need to find it if I want to access the same Git repos from a new computer? Or can I simply generate new keys?

like image 563
Kokodoko Avatar asked Oct 24 '25 02:10

Kokodoko


1 Answers

The key is stored in your home directory at ~/.ssh. For Windows, this means C:\Users\<username>\.ssh. You can copy that whole directory to the new machine to keep the keys the way they are.

However, copying the keys is usually discouraged. The key in question is a private key which should stay private at all costs. Whoever has the key can communicate with GitHub or other sites on your behalf. So it’s recommend that you avoid having to copy it ever to something else (so you don’t accidentally allow others to copy it too).

Instead, you should create a new key on your new machine, add that to GitHub and remove the old one. See this help page on how to do that.

like image 79
poke Avatar answered Oct 26 '25 23:10

poke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!