Windows下git配置多個sshkey

來源:互聯網
上載者:User

標籤:

產生sshkey

ssh-keygen -t rsa -C "[email protected]" -f filename

沒有指定f選項或f選項為空白時,產生的私密金鑰和公開金鑰為:id_rsa和id_rsa.pub

為了同時串連多個源需要為不同的源設定不同的名稱,否則會被覆蓋掉

PS1:Windows命令列沒有ssh-keygen,可以在GitBash中執行

PS2:ssh-keygen產生的key預設儲存在~/.ssh/目錄下

 

把產生的sshkey添加到~/.ssh/config

IdentityFile ~/.ssh/github-keyIdentityFile ~/.ssh/gitlab-key

將產生的所有Key添加到config檔案中

PS1:“~/”在Windows下表示目前使用者目錄,如~/.ssh/表示的是C:/Users/yourname/.ssh/目錄

PS2:~/.ssh/config檔案不存在的話需要手動建立

 

為不同的項目設定單獨的user.name和user.email

git config user.name yournamegit config user.email your[email protected]

 

Windows下git配置多個sshkey

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.