1.服务器上设置github对应用户名和邮箱
git config --global user.email “your github email”
git config --global user.name "your github username"
2.服务器用ssh生成公私钥
ssh-keygen -t rsa -C "your_email@example.com"
然后
cd ~/.ssh
ls
然后
cat id_rsa.pub
然后把内容复制到github的setting中的SSH里,就能把服务器和github建立连接啦
3.服务器去掉http代理(因为我们用的是ssh)
git config --global --unset http.proxy
git config --global --unset https.proxy
4.在github上建立一个自己的私人仓库
5.进入私人仓库,上面选SSH,然后按照下面的命令提示,逐行敲在cmd里就可以
参考:github设置添加SSH - 破男孩 - 博客园https://www.cnblogs.com/ayseeing/p/3572582.html