在同一台电脑上添加多个ssh key
2017-03-18 10:11
141 查看
1.创建新的ssh key:
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
ssh-keygen -t rsa -C "your_email@email.com"
然后让你输入新的文件名称,这里设置为new
# 设置名称为Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): ~/.ssh/new
2.密钥添加到SSH agent中
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
ssh-add ~/.ssh/new
ssh-add -l 可以查看添加过的密钥
shh-add -D 可以删除
如果出现Could not open a connection to your authentication agen
就执行:
ssh-agent bash
ssh-add ~/.ssh/new
3.把创建的~/.ssh/new.pub中的内容添加到你的github账号上。
4.在~/.ssh创建或者修改config文件
# new
Host new
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/new
5.测试
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
ssh -T git@new
6.clone仓库
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
git clone git@new:username/git-demo.git
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
ssh-keygen -t rsa -C "your_email@email.com"
然后让你输入新的文件名称,这里设置为new
# 设置名称为Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): ~/.ssh/new
2.密钥添加到SSH agent中
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
ssh-add ~/.ssh/new
ssh-add -l 可以查看添加过的密钥
shh-add -D 可以删除
如果出现Could not open a connection to your authentication agen
就执行:
ssh-agent bash
ssh-add ~/.ssh/new
3.把创建的~/.ssh/new.pub中的内容添加到你的github账号上。
4.在~/.ssh创建或者修改config文件
# new
Host new
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/new
5.测试
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
ssh -T git@new
6.clone仓库
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
git clone git@new:username/git-demo.git
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; text-align: justify; font: 16.0px "PingFang SC"; color: #333333 }
span.s1 { }
相关文章推荐
- windows一台电脑添加多个git账号
- 一台电脑添加多个git账户
- 添加注册表让一台电脑如何同时登陆多个msn
- 在.NET中获取一台电脑名,IP地址及当前用户名
- 远程登录某一台电脑时提示凭证不正确问题
- 在.NET中获取一台电脑名,IP地址及当前用户名
- 一台电脑重装 MAC OS
- 你的.net 2.0 真的能与1.1 安全正确地运行在同一台电脑上吗? 小心Server Application Unavailable 错误
- 把Outlook Express邮件从一台电脑导入另一台电脑的详细方法步骤(图)
- 如何DIY一台属于你自己的电脑?
- mysql主从 1.一台电脑上安装俩个mysql
- 在同一台电脑上运行两个或多个MOOS-IvP application
- 如何把microsoft outlook下的邮件转到另一台电脑的express outlook里?
- 两台win 7系统电脑 一台双网卡 共享上网
- 一台电脑同时运行多个tomcat配置方法
- 电脑添加宽带连接拨号上网
- 整体复制的unity工程在另一台电脑上打开,但mono无法调试的解决办法
- 本机测试(一台电脑)ajax的方法
- 如何最快拥有一台新电脑
- 一台电脑启动多个tomcat