Git 设置多个ssh-key对应多个项目

①:生成ssh-keygit

  运行命令: ssh-keygen -t rsa  建立多个key保证名称不一致便可、目前建立了 id_rsa_test、id_rsa_ test1   用于演示config文件编写github

  

②:配置config文件    没有config文件直接建立一个就行   config文件在.ssh目录下服务器

  Host test               注:能够随便写、关联远程仓库时须要用到ssh

    HostName github.com          注:服务器地址 自行选择
    IdentityFile C:\\Users\\Administrator\\.ssh\\id_rsa_test   注:对应的文件    
    PreferredAuthentications publickey
    User username_1spa

  

  Host test1blog

    HostName github.com
    IdentityFile C:\\Users\\Administrator\\.ssh\\id_rsa_test1
    PreferredAuthentications publickey
    User username_2it

③:添加keyio

  

④:项目关联class

  

  注:  "git@"   后面是config文件中的对应的Host值test

相关文章
相关标签/搜索