開篇日常立個flag....
安裝Git
此處略去一萬字
了解幾個東西
為什么要配置公鑰、私鑰?配置了有什么用(對於Git)?怎么配置?
(以后補充)
Git 配置SSH公鑰、私鑰
1、進入Git Bash
鼠標右鍵<Git Bash Here>(或者文件路徑里敲<Git Bash.lnk>)
2、輸入生成 Rsa 秘鑰對的命令
ssh-keygen -t rsa -C "your_email@example.com"
3、秘鑰名稱
Enter file in which to save the key (/c/Users/CL/.ssh/id_rsa): <輸入秘鑰名稱/直接回車>
注:本例中,輸入秘鑰名稱為:lisheng741
4、輸入密碼和確認密碼
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
都可空,直接回車,等待生成秘鑰對。
本地會生成兩個文件:
lisheng741 私鑰
lisheng741.pub 公鑰
5、本地添加私鑰
ssh-add <私鑰路徑>
6、讀取公鑰
方式1:cat <公鑰文件>
方式2:以文本方式打開公鑰文件
將公鑰文本復制,用於下一步
7、在 Github / Gitee 添加公鑰
Github:點自己頭像 >> Settings >> SSH and GPG keys >>New SSH key
Gitee:點自己頭像 >> 設置 >> SS公鑰
參考來源
https://blog.csdn.net/july_young/article/details/82712574 (july_young 的 git添加私鑰)
https://www.cnblogs.com/kaerxifa/p/11164206.html (wangju003 的 git配置密鑰(私鑰、ssh、公鑰))
Git配置SSH公鑰、私鑰 踩坑記錄
第5步本地添加私鑰時,提示:
Could not open a connection to your authentication agent.
具體原因沒有細究,解決方案:先執行命令:ssh-agent bash
參考來源
https://www.cnblogs.com/sheldonxu/archive/2012/09/17/2688281.html (Sheldon Xu 的 執行ssh-add時出現Could not open a connection to your authentication agent)