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

相關文章
相關標籤/搜索