git: windows git ssh keys產生

來源:互聯網
上載者:User

標籤:src   _for   clip   class   title   bar   png   右鍵   targe   

http://blog.csdn.net/lsyz0021/article/details/52064829


當我們使用github或者bitbucket等倉庫時我們有可能需要ssh認證,所以需要產生他的ssh key。


1、首先你要安裝Git工具

:https://git-scm.com/downloads


2、右鍵滑鼠,選中 “Git Bash here”,當然你也可以在windows的 “開始”--->“所以程式”,或者安裝目錄開啟它

                                               


3、輸入指令,進入.ssh檔案夾

[java] view plain copy 
  1. cd ~/.ssh/  

 



如果提示 “ No such file or directory”,你可以手動的建立一個 .ssh檔案夾即可

命令為:

 

[java] view plain copy 
  1. mkdir ~/.ssh  

 

4、配置全域的name和email,這裡是的你github或者bitbucket的name和email

 

[java] view plain copy 
  1. git config --global user.name "xkwg"  
  2.   
  3. git config --global user.email "[email protected]"  


5、產生key

 

 

[java] view plain copy 
  1. ssh-keygen -t rsa -C “xkwg@163.com”  


    連續按三次斷行符號,這裡設定的密碼就為空白了,並且建立了key。

    Your identification has been saved in /User/Admin/.ssh/id_rsa.
    Your public key has been saved in /User/Admin/.ssh/id_rsa.pub.
    The key fingerprint is:
    ………………


最後得到了兩個檔案:id_rsa和id_rsa.pub

 


6、開啟Admin目錄進入.ssh檔案夾,用記事本開啟id_rsa.pub,複製裡面的內容添加到你github或者bitbucket ssh設定裡即可






這是bitbucket的添加key,點擊右上方的頭像,選擇設定,然後




這是github添加key




7、測試是否添加成功


bitbucket輸入命令:

 

[java] view plain copy 
  1. ssh -T git@bitbucket.org  

 

 

提示:“You can use git or hg to connect to Bitbucket. Shell access is disabled.” 說明添加成功了


github輸入命令:

 

[java] view plain copy 
  1. ssh git@github.com  

提示:“Hi lsyz0021! You‘ve successfully authenticated, but GitHub does not provide shel l access.”說明添加成功。

 


 

git: windows git ssh keys產生

聯繫我們

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