生成ssh密钥

替换其中的your_email@example.com为自己的github账号邮箱地址

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

添加SSH密钥到 SSH-Agent

ssh-add ~/.ssh/id_rsa

获取公钥

执行以下命令,复制输出的公钥,添加到github平台ssh key里:https://github.com/settings/ssh/new

cat ~/.ssh/id_rsa.pub

测试连接

ssh -T git@github.com