Can you use the same ssh key for different version control hosting services?
And if you can, what are the pros and cons?
Scenario: I have ssh keys that I am using on my computer, can I and should I use the same ssh keys with gitlab/gitbucket on the same computer?
The problem with multiple GitLab accounts is that you can't use one SSH key on both of them. For example, you have a personal email address associated with one GitLab account, and business email with another.
GitHub does not allow us to use the same SSH key in multiple accounts, so we'll have to create separate keys for each account. We can create SSH keys and add them to our SSH agent by following this guide from the GitHub Documentation.
Yes you can, you can share the same key between them both (ssh key) or create a new one per git server.
Yes it is. You tell git where the remote code lives from a per-repository configuration file. You can even push to GitHub and Bitbucket from the same repository if you want to. One important piece will be connecting to each separately with SSH.
No, it is not advisable: a private key should remain used for only one service, that way you can revoke/change it just for that service.
What you can do is set up a ~/.ssh/config
file in which you can associate the right private key with the right host, as explained here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With