How many github ssh keys do I need for a small dev

2019-04-21 03:50发布

问题:

I'm confused by the concept of SSH keys when it comes to using a remote repository hosted by GitHub. I generated the keys as instructed in http://help.github.com/win-set-up-git/ , but now that I have multiple devs pushing into the repo, I'm not clear if we're all to share one single SSH key or if we all need to generate an individual key per-machine and use that?

Could someone kindly clarify that for me?

回答1:

An SSH key is used for the user to be authenticated and identified into GitHub.

It is common that, for every different device a user uses to access GitHub, he generates a different ssh-key and register/link it to his GitHub's account.

When you control a project, you control access and permissions based on users, and not SSH keys.

So, when you (as a user) setup your git environment you can create only one ssh-key for each machine you would like to give permission to your GitHub's account.


Update:

Github now recommends using HTTPS instead of SSH keys but everything in this answer remains valid if you replace all SSH key references above by Github's Personal Access Tokens



回答2:

Use a key per developer - each dev should generate their own key. This gives you a better indication of who is committing to the repo, and means that you can revoke a developer's commit rights if/when they leave the company. Otherwise they could just copy the shared key, and you would have to re-issue a new one every time you needed to change access rights.



标签: git ssh github