码迷,mamicode.com
首页 > 其他好文 > 详细

配置多个github公钥

时间:2018-05-10 17:21:46      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:mon   user   nbsp   添加   rsa   rgba   entity   highlight   本地   

1 配置 github 公钥

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为文件后缀】

如果直接回车,则在~/.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: 都回车

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

增加ssh配置文件 

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文件权限

chmod 600 config

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

 

  

 

配置多个github公钥

标签:mon   user   nbsp   添加   rsa   rgba   entity   highlight   本地   

原文地址:https://www.cnblogs.com/drop-in-ocean/p/9020112.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!