user1154488
user1154488

Reputation: 157

Git: How to add ssh key?

I'm trying to understand how to set up SSH keys for GitHub. I'm not sure exactly how to word things... So, this is a breakdown of what I've done and what I'm trying to do...

  1. I generated an SSH key on Server A, from which I'll be pushing / pulling to my GitHub repository

  2. I've added an SSH Key in my Account Settings on GitHub and copied over the contents of Server A's id_rsa.pub file

  3. I can now successfully push and pull from Server A to / from my GitHub repository

Now, I want to also setup another server (Server B) so that I can push and pull from that one as well.

My question is: Do I have to generate a new ssh key on Server B, or can I "re-use" the one I've already setup? Meaning, do I have to have a completely unique ssh key on each server I'll be pushing and pulling from? If not, how can I add the id_rsa.pub file so that it's the same information? Is it just as simple as copying the files?

Upvotes: 2

Views: 3259

Answers (1)

Learath2
Learath2

Reputation: 21393

Its possible to use the same key but its not advised. If someone takes control of Server B you would have to regenerate a new key for A and disable access for old command. Its just not secure enough.

You should generate a new key for all machines you own. So you can individually control access for servers.

Upvotes: 2

Related Questions