美文网首页
git 多账号配置

git 多账号配置

作者: noteby | 来源:发表于2018-11-12 14:35 被阅读0次
    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
    

    相关文章

      网友评论

          本文标题:git 多账号配置

          本文链接:https://www.haomeiwen.com/subject/eufcfqtx.html