配置多个 ssh key
有时候我们需要在一台电脑配置多个 ssh key,用于支持不同的 git 的平台或者在同一 git 平台使用几种不同的 ssh key
什么是 ssh
参考百度百科的说明 点这里
如何生成 ssh key
如何生成 ssh key 这里不做介绍,请查看 https://help.github.com/articles/generating-an-ssh-key/
默认的 ssh key
默认的 ssh key 记录在这里

生成不同的 ssh key
与生成 ssh key 相同,区别在于这里


添加到 ssh agent
生成好的 ssh key 我们需要添加到 ssh agent 中,与添加默认的 ssh key 一样

添加config文件
最后我们需要需要在 .ssh 目录中创建一个 config 文件
# gitcafe
Host gitcafe.com
HostName gitcafe.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.gitcafe
现在我默认是使用的 github 的 ssh key,当 host 是 gitcafe.com 时则使用 gitcafe 的 ssh key

许可协议:署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
本文链接:https://tanglj.cn/2016/04/06/mutiple-ssh-key/