如何找到本身的公鑰

一、在終端輸入命令行:html

 
ssh-keygen -t rsa -C 
"xxxxx@xxxxx.com" 
 

二、找到SSH公鑰默認儲存在帳戶的主目錄下的~/.ssh目錄git

看有沒有id_rsa和id_rsa.pub,  有.pub後綴的文件是公鑰,另外一個id_rsa文件則是祕鑰。安全

三、把公鑰文件拖到Xcode裏面,就會查看到公鑰了ssh

注:ide

假如沒有這些文件,甚至連 .ssh 目錄都沒有,能夠用 ssh-keygen 來建立。該程序在 Linux/Mac 系統上由 SSH 包提供,而在 Windows 上則包含在 MSysGit 包裏:spa

$ ssh-keygen -t rsa -C "your_email@youremail.com"

Creates a new ssh key using the provided email # Generating public/private rsa key pair.

Enter file in which to save the key (/home/you/.ssh/id_rsa):

直接按Enter就行。而後,會提示你輸入密碼,以下(建議輸一個,安全一點,固然不輸也行,應該不會有人閒的無聊冒充你去修改你的代碼):命令行

Enter same passphrase again: [Type passphrase again]

完了以後,大概是這樣:code

Your public key has been saved in /home/you/.ssh/id_rsa.pub.
The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@youremail.com

到此爲止,你本地的密鑰對就生成了。htm

詳情細節參見:blog

https://git-scm.com/book/zh/v1/%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84-Git-%E7%94%9F%E6%88%90-SSH-%E5%85%AC%E9%92%A5

http://www.cnblogs.com/superGG1990/p/6844952.html