你可以吗?是否建议为 github 和 gitlab/gitbucket 使用相同的 ssh 密钥 [英] Can you and is it advisable to use the same ssh key for github and gitlab/gitbucket

查看:10
本文介绍了你可以吗?是否建议为 github 和 gitlab/gitbucket 使用相同的 ssh 密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以为不同的版本控制托管服务使用相同的 ssh 密钥吗?

Can you use the same ssh key for different version control hosting services?

如果可以的话,有什么好处和坏处?

And if you can, what are the pros and cons?

场景:我的电脑上有 ssh 密钥,我可以和应该在同一台电脑上使用与 gitlab/gitbucket 相同的 ssh 密钥吗?

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?

推荐答案

不,这是不可取的:私钥应仅用于一项服务,这样您就可以仅为该服务撤销/更改它.

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.

你可以做的是设置一个 ~/.ssh/config 文件,您可以在其中将正确的私钥与正确的主机相关联,如 这里解释.

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.

这篇关于你可以吗?是否建议为 github 和 gitlab/gitbucket 使用相同的 ssh 密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆