Git SSH keys 從生成到使用

覺得內容不錯請關注個人博客:https://lijianxun.top/
最新文章將在個人博客上發佈。
原文地址:https://lijianxun.top/157.html

配置 git 用戶名和郵箱

git config --global user.name "git 用戶名"
git config --global user.email "git 郵箱"

生成公鑰和私鑰

ssh-keygen -t rsa -C "git 郵箱"

然後一路回車,直到生成類似的圖形:

+--[ RSA 2048]----+
|                 |
|                 |
|        . E +    |
|       . o = .   |
|      . S =   o  |
|       o.O . o   |
|       o .+ .    |
|      . o+..     |
|       .+=o      |
+-----------------+

獲取 id_rsa.pub

找到 .ssh 目錄,查看 id_rsa.pub 文件,全部複製,接下來去 github 裏配置。

配置 github

在 github 的設置裏找到 SSH and GPG key,填入名稱和剛複製的內容,保存即可。

這樣配置以後就可以直接使用 [email protected] 開頭的倉庫鏈接,不再輸入用戶名和密碼。

覺得內容不錯請關注個人博客:https://lijianxun.top/
最新文章將在個人博客上發佈。
原文地址:https://lijianxun.top/157.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章