管理Git生成多个ssh key
2016-08-23 17:41
176 查看
管理Git生成多个ssh key
生成两个key生成key的命令
ssh-keygen -t rsa -C “Your Email Address” -f 'Your Name',-f后面给的生成key的名字,如果没有指定新的名字,那么每次ssh-keygen生成的名字相同,就会发生覆盖同名文件的情况的发生。
生成两个key后,添加到对应服务器的ssh kyes管理设置中。
本地添加私钥
本地添加私钥名命令
ssh-add ~/.ssh/Your Key Name,如果出现“Could not open a connection to your authentication agent”的问题,可以执行命令
ssh-agent bash,再运行添加命令。另外,可用通过
ssh-add -l查看私钥列表
ssh-add -D来清空私钥列表
修改配置文件
1.在~/.ssh目录下新建一个config的文件
2.添加以下内容
# oschina Host git.oschina.net HostName git.oschina.net PreferredAuthentications publickey IdentityFile ~/.ssh/oschina # github Host github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa3.一点说明
以上的我采用的是oschina的码云和github的两种kye的结合体,其中每段最后的
IdentityFile跟着是你自己ssh key的名字,不要搞错了。
最后就是测试咯
oschina的测试方法
ssh -T git@git.oschina.net;成功收到的回复为“Welcome to Git@OSC,‘Your Name’ ”
github的测试方法
ssh -T git@github.com;成功收到的回复为”Hi ’Your Name‘ ! You’ve successfully authenticated, but GitHub does not provide shell access.“
借鉴文章
git 配置多个SSH-Key
管理git生成的多个ssh key
相关文章推荐
- 管理git生成的多个ssh key
- 管理git生成的多个ssh key
- 管理Git生成多个ssh key
- 管理git生成的多个ssh key
- git生成ssh key及本地解决多个ssh key的问题
- Git SSH Key 生成步骤
- Git SSH Key 生成步骤
- 关于ssh key 的使用(git版本管理工具)
- Git SSH Key 生成步骤
- mac使用git管理Github以及生成 SSH 公钥
- Git SSH Key 生成步骤
- Git SSH Key 生成步骤
- Git SSH Key 生成步骤
- github管理的建立(SSH Key生成步骤)
- Git SSH Key 生成步骤
- Git SSH Key 生成步骤
- Git SSH Key 生成步骤
- 转载:Git SSH Key 生成步骤
- Git SSH Key 生成步骤
- Git SSH Key 生成步骤