git config --g lobal user.email "你的GitHub邮箱"
git config --g lobal user.name "你的GitHub用户名"
ssh-keygen
全部回车
找到 Your public key has been saved in ……
本文中是/root/.ssh/id_rsa.pub
cat /root/.ssh/id_rsa.pub
复制输出,加入GitHub的ssh设置
测试一下:
ssh -T git@github.com
若报You've successfully authenticated, but GitHub does not provide shell access.
,则在你想免密连接的仓库下执行
git remote set-url origin git@github.com:用户名/仓库名.git
就可以了。
参考Github Authentication Failed - … GitHub does not provide shell access