GitHub設置公鑰在windows下面
1. 安裝git,從程序目錄打開 "Git Bash"
2. 鍵入命令:ssh-keygen -t rsa -C "email@email.com"
"email@email.com"是github賬號
3. 提醒你輸入key的名稱,輸入如id_rsa
如果執行成功。返回
Generating public/private rsa key pair.
Enter file in which to save the key (/home/forwhat.cn/.ssh/id_rsa):
在這里就是設置存儲地址了.反正我是直接按的回車
然后還會返回
Enter passphrase (empty for no passphrase):
再次直接回車。
Enter same passphrase again:
再次回車。
Your identification has been saved in /home/forwhat.cn/.ssh/id_rsa.
Your public key has been saved in /home/forwhat.cn/.ssh/id_rsa.pub.
The key fingerprint is:
這里有一串數。我把他屏蔽了。
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| o |
| + . S |
| . = . o |
| o + +o.o |
|E o . o.=+. |
|.+ ==+ooo. |
+-----------------+
4. 在C:\Documents and Settings\Administrator\下產生兩個文件:id_rsa和id_rsa.pub
5. 把4中生成的密鑰文件復制到C:\Documents and Settings\Administrator\.ssh\ 目 錄下。
6. 用記事本打開id_rsa.pub文件,復制內容,在github.com的網站上到ssh密鑰管理頁面,添加新公鑰,隨便取個名字,內容粘貼剛
需要注意步驟2中產生的密鑰文件在當前用戶的根目錄,必須把這兩個文件放到當前用戶目錄的“.ssh”目錄下才能生效。