配置多个github公钥

1 配置 github 公钥git

ssh-keygen -t rsa -C "git@github.com"

2  Enter file in which to save the key (/home/fe/.ssh/id_rsa): 此时键入id_rsa.xxx 【xxx为文件后缀】github

若是直接回车,则在~/.ssh/下,会生成
    id_rsa(私钥)和id_rsa.pub(公钥)
若是输入id_rsa.xxx,则在~/.ssh/下生成为
    id_rsa.xxx(私钥)和id_rsa.xxx.pub(公钥)

Enter passphrase (empty for no passphrase):以及 Enter same passphrase again: 都回车vim

4 重复步骤1-3,生成公私钥 id_rsa.zzz和id_rsa.pubssh

增长ssh配置文件 spa

cd ~/.ssh
touch config
vim config

Host git@git.kangfuzi.com
HostName git@git.kangfuzi.com
User git
IdentityFile ~/.ssh/id_rsa.xxx

Host git@git.kangfuzi.com
HostName git@git.kangfuzi.com
User git
IdentityFile ~/.ssh/id_rsa.zzz
6 将 id_rsa.xxx和id_rsa.zzz 加入 本地 ssh
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa.xxx
ssh-add ~/.ssh/id_rsa.zzz

7 设置config文件权限code

chmod 600 config

8 最后将各个公钥分别添加至git上便可blog

相关文章
相关标签/搜索