Github SSH 設置
設置 GitHub SSH clone, push 專案
環境
macOS
實作
- 生成 SSH Key
1
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- 取得生成的公鑰
1 2
cat /Users/你的使用者名稱/.ssh/id_rsa.pub 例如:cat /Users/kunjili/.ssh/id_rsa.pub
會輸出類似以下的內容,稍後設置會用到
1
ssh-rsa AAAAB3Nza(中間略)b9gOxL0tSVMBQ== kunji.li@outlook.com
測試
新增成功後測試看看
1
ssh -T git@github.com
成功的話會看到類似以下訊息
1
Hi occultationtw! You've successfully authenticated, but GitHub does not provide shell access.
參考資料
本文章以 CC BY 4.0 授權