美文网首页
failed to push some refsto

failed to push some refsto

作者: 帮我的鸵鸟盖个章 | 来源:发表于2021-06-07 17:29 被阅读0次
前情提要

新建,github仓库,第一次上传文件到仓库。

详细报错

error: failed to push some refsto 'git@github.com:hello-u/test.git'。

错误原因

在创建仓库时,勾选了新建readMe.md文件,这个时候github会帮我们做一个初始提交。当我们本地提交内容时,远程仓库和本地仓库都有自己的内容,但是两端是没有联系的,所以git会让你先pull远程仓库,但是你拉取的时候总会失败。

202168-105524.png
解决办法
方法一

git pull --rebase origin main 重新定位远程仓库

git push -u origin main 重新上传

方法二

新建仓库的时候不要勾选readMe.md等三个选择项,手动添加后再上传。

相关文章

网友评论

      本文标题:failed to push some refsto

      本文链接:https://www.haomeiwen.com/subject/kxqkvktx.html