git 多账号配置

2018-11-12  本文已影响0人  noteby
  1. 生成新密钥
ssh-keygen -t rsa -C "email"
  1. 注册新的私钥
ssh-add ~/.ssh/id_rsa
  1. 查看私钥列表
ssh-add -l 
  1. 新建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
上一篇下一篇

猜你喜欢

热点阅读