前置#
終端 git、ssh-keygen 命令正常使用
檢查系統內是否已經有 ssh 密鑰#
Linux、MacOS 終端執行:
ls ~/.ssh
git 全局配置#
git config --global user.name 你的用戶名
舉例:git config --global user.name zhiao
git config --global user.email 你的郵箱
舉例:git config --global user.email [email protected]
生成秘鑰#
ssh-keygen -t rsa -C '你上面git配置的郵箱'
舉例:ssh-keygen -t rsa -C '[email protected]'
將公鑰貼上至 Github#
github-> 右上角頭像 ->setting->SSH and GPG keys->New SSH key
- 起個 Title
- 終端進入~/.ssh 目錄,將.pub 結尾的文件內容貼上到 Key 中
- Add SSH key