$ ssh-keygen -t rsa -C "hong@hongfs.cn"# 这里要写你的邮箱,然后一直回车就可以了 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:P0loplFOUzyaHe1v8gHGA52HEyK4cJsACSKV3feEk hong@hongfs.cn The key's randomart image is: +---[RSA 2048]----+ |=+.oo oE*o. | |=... o.B+BB | |. . * X* * | | Boo= . | | . S .o | | = o..+ | | . ++ . | | .. | | | +----[SHA256]-----+
Enter file in which to save the key 意思是生成的文件放哪里
创建完后我们需要把生成的 ssh key 放到 github 上面的 deploy keys
点击右上角的 Add deploy key,把我们生成的 ssh key 放进去,然后保存。
现在需要拉取 github 到本地来,记得使用 ssh 方式别用 https
1 2 3 4 5 6
$ git clone git@github.com:hongfs/webhook-test.git Cloning into 'webhook-test'... The authenticity of host 'github.com (52.74.223.119)' can't be established. RSA key fingerprint is SHA256:nThbg6XUpJWGl7E1IGOCspRomTxdCARLviw6E5SY8. RSA key fingerprint is MD5:16:xq:ac:a5:76:28:2d:36:wv:1b:56:4d:ea:df:a6:48. Are you sure you want to continue connecting (yes/no)? yes