1拄衰、 ssh-keygen -t rsa -b 4096 -C "郵箱"
命令行輸出:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/liuhongliang/.ssh/id_rsa):此處為了方便直接按回車徐伐,防止后面出現(xiàn)錯誤不知道怎么解決
Enter passphrase (empty for no passphrase): 輸入你的證書密碼偶宫,驗證時會用到
Enter same passphrase again: 確認(rèn)密碼
2蒋畜、eval "$(ssh-agent -s)"
3蹦魔、ssh-add -K ~/.ssh/id_rsa
此時已經(jīng)生成了。
驗證
4铁追、ls -al ~/.ssh
輸出
staff 170 5 18 14:42 .
staff 1394 5 18 14:27 ..
staff 3326 5 18 14:42 id_rsa
staff 742 5 18 14:42 id_rsa.pub // - 如果有它表示成功了
staff 407 5 18 14:24 known_hosts
5璧亚、pbcopy < ~/.ssh/id_rsa.pub // 拷貝公鑰
6、 到github網(wǎng)站脂信,
image.png
2.png
image.png
image.png