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)錯(cuò)誤不知道怎么解決
Enter passphrase (empty for no passphrase): 輸入你的證書密碼,驗(yàn)證時(shí)會(huì)用到
Enter same passphrase again: 確認(rèn)密碼
2、eval "$(ssh-agent -s)"
3、ssh-add -K ~/.ssh/id_rsa
此時(shí)已經(jīng)生成了。
驗(yàn)證
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