windows環境下 產生git公開金鑰和私密金鑰

來源:互聯網
上載者:User

標籤:mail   檔案內容   comment   https   tor   xxx   .com   開啟   window   

windows環境下 產生公開金鑰和私密金鑰
  1. 上傳代碼到遠程倉庫的時候需要秘鑰進行驗證是否本人上傳的。開啟Git目錄下的Git Bash

    輸入ssh-keygen,斷行符號
  2. 可直接不輸入路徑,使用預設路徑(c/Users/Administrator/.ssh/)
  3. 按照提示要輸入兩次密碼,但是如果輸入了,每次操作操作git庫時都要輸入密碼,所以選擇不輸入密碼
  4. 密碼輸入結束後,提示已產生秘鑰
  5. 開啟c:/Users/Administrator/.ssh/,在檔案中,id_rsa是私密金鑰檔案,id_rsa.pub是公開金鑰檔案
  6. 將公開金鑰檔案內容添加到github中的ssh公開金鑰
  7. 回到git bash,輸入

    ssh -T git@git.oschina.net
  8. 如果顯示 ‘Welcome to [email protected], your username!‘,則表示成功

修改本地的ssh remote url。不用https協議,改用git協議
  1. 查看當前的remote url,可以看到是使用https協議進行訪問的

    git remote -v  orgin https://github.com/xxx/xxx.git(fetch)  orgin https://github.com/xxx/xxx.git(push)
  2. 調整url,使用項目的ssh url

    git remote set-url origin git@github.com:xxx/xxx.git

參考:http://jingyan.baidu.com/article/948f5924ee425dd80ff5f90c.html

windows環境下 產生git公開金鑰和私密金鑰

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.