一、创建github账户之后,记住注册邮箱和账户名
我的邮箱:[email protected]
账户名:thekingofjumpshoot
下边的相关位置需要用自己的邮箱和用户名替代
二、输入本地生成秘钥和公钥命令,并且生成公私钥对
ssh-keygen -t rsa -C "[email protected]"
输入命令后连摁三次enter即可生成秘钥

找到如图中的公钥位置,将其复制粘贴的github上的对应位置

如图是公钥的样子,复制出来待会使用

三、公钥粘贴的位置




四、测试是否连通
sh -T [email protected]
若出现The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ECDSA key fingerprint is SHA256:XXX.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
输入 yes
再输入一遍 ssh -T [email protected]
提示 Hi user.name! You've successfully authenticated, but GitHub does not provide shell access.
效果如图,即连接成功

五、配置过之后,下一次只需要输入如下代码即可连接
git config --global user.email "[email protected]"
git config --global user.name "thekingofjumpshoot"