- 生成新密钥
ssh-keygen -t rsa -C "email"
- 注册新的私钥
ssh-add ~/.ssh/id_rsa
- 查看私钥列表
ssh-add -l
- 新建config文件
vi ~/.ssh/config
Host host1
Hostname github.com
User user1
PreferredAuthentications publickey
IdentityFile /home/xxx/.ssh/id_rsa_1
Host host2
Hostname git.xxx.cn
User user2
PreferredAuthentications publickey
IdentityFile /home/xxx/.ssh/id_rsa_2
# 提示错误:
# Their offer: diffie-hellman-group1-sha1 fatal: Could not read from remote repository.
# 解决方法:
Host *
KexAlgorithms +diffie-hellman-group1-sha1
网友评论