我在一台设备上有多个 SSH 密钥。
// example
id_rsa_github_office.pub , id_rsa_github_personal.pub
如何在单个设备上管理多个 SSH 密钥而不发生冲突?
创建 SSH 配置文件
当您有多个身份文件时,请创建 SSH 配置文件机制来为您的各种身份创建别名。
您可以使用许多参数和不同的方法构建 SSH 配置文件。
本示例中使用的别名条目的格式为:
Host alias
HostName bitbucket.org
IdentityFile ~/.ssh/identity
要为两个身份(workid 和 individualid)创建配置文件,您将执行以下操作:
Open a terminal window.
Edit the ~/.ssh/config file.
如果您没有配置文件,请创建一个。
为每个身份组合添加别名,例如:
Host workid
HostName bitbucket.org
IdentityFile ~/.ssh/workid
Host personalid
HostName bitbucket.org
IdentityFile ~/.ssh/personalid
PS
不要忘记将密钥加载到您的 github 帐户。
如何将ssh密钥添加到github帐户?
- 登录github账户
- Click on the rancher on the top right (Settings)
- Click on the
SSH keys
- Click on the
Add ssh key
- 粘贴您的密钥并保存
你们都准备好了:-)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)