配置多個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

相關文章
相關標籤/搜索