Git生成本機SSH Key並添加到GitHub中


 

1.檢查電腦里是否有SSH Key

打開git Bash客戶端

cd ~/.ssh
ls

如果有就會輸出下面內容

config  id_rsa  id_rsa.pub  known_hosts

2.創建

郵箱為注冊github的郵箱

ssh-keygen -t rsa -C "你的郵箱"

 可以直接按enter鍵

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/peng/.ssh/id_rsa): 

 

也可以指定目錄

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/peng/.ssh/id_rsa): C:\Users\peng\ssh\id_rsa

 

提示輸入密碼,直接按enter鍵

Enter passphrase (empty for no passphrase):
Enter same passphrase again:

 

成功后會提示

Your identification has been saved in C:\Users\peng\ssh\id_rsa.
Your public key has been saved in C:\Users\peng\ssh\id_rsa.pub.
The key fingerprint is:
SHA256:I3MqfNzPqqsjwDDhunBFZpPJ/qSSDlbY+TQGvN7HRUk 961159376@qq.com
The key's randomart image is:
+---[RSA 3072]----+
|  .. o  .E.      |
|.  oO    o       |
|..o=+.  .        |
|oo =o+.  .       |
|+.oo=+= S        |
|=o+o.+.O .       |
|o* .o = .        |
|. o .o   o       |
|   ..ooo..o      |
+----[SHA256]-----+

 

3.在github添加ssh key

將id_rsa.pub文件內容復制到github的ssh key里

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM