Github與主機使用SSH驗證

攻城人生 RED Lin 2022-07-05 109

於終端機執行以下指令產生金鑰

1
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

執行後會有三個問題
第一個是金鑰保存的路徑
第二、三個是金鑰的保護密碼
這邊密碼建議留空就好

1
2
3
Enter file in which to save the key (/home/username/.ssh/id_rsa): /home/username/.ssh/github_key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

之後把 公開密鑰(.pub) 新增到 github 設定即可