error: failed to push some refs to 'https://github.com/qhlpn/Algorithm.git' hint: Updates were rejected because the remote contains work that you do

出错原因:上传前,本地与GitHub上远程仓库内容不一样

解决方法:上传前,先进行下拉操作,同步本地与远程库

git init  // 初始化本地库
git add files // 添加到暂存区
git commit -m "desc"  // 提交到本地版本库
git remote add zidingyi + GitHub仓库地址 // 绑定
git pull zidingyi master // 下拉
git push -u zidingyi master // 上传

猜你喜欢

转载自www.cnblogs.com/qhlpn/p/10852555.html