1.安装Git:
sudo apt install git -y
2.完成Git的基础配置:
git config–globaluser.name"your name"
git config–globaluser.email your@example.com
注:将your name替换成你自己的Github用户名,将your@example.com替换成注册Github时填写的邮箱。
3.生成ssh公钥私钥:
ssh-keygen-trsa-b4096-C"your_email@example.com" (然后会有提示输入密码,我们一直回车就行)
eval"$(ssh-agent-s)"
ssh-add ~/.ssh/id_rsa
ls .ssh(有公钥和私钥两个文件)
注:将your_email@example.com替换成你自己的任意邮箱
4.将公钥添加到Github:
cd .ssh
cat~/.ssh/id_rsa.pub(通过鼠标选中所有内容并手动复制)
转跳:
https://github.com/settings/ssh/new(将内容粘贴至Key框中,Title随便起,最后点击Add SSH Key)
5.测试ssh连接:
ssh-Tgit@github.com(提示yes/no,输入yes,可以查看是否成功连接)