Github存储库不会拉或推

问题描述

所以基本上我是:

  1. 制作一个Github存储库并将其克隆到我的桌面上
  2. 从Github修改了README.md文件,但忘记将其拉到我的桌面上
  3. 用2个小时的代码完成10多次提交

Git不允许我推动

![rejected]
error: failed to push some refs

Git不会让我拉扯

Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.

我该怎么办?

解决方法

您应该从服务器获取更改,然后合并或重新设置它们。

git fetch --all
git rebase origin/master
git mergetool (most likely you will have some conflicts)
git push origin master

您可以手动或使用mergetool解决冲突。对于手动,您将更改文件并运行git add <file>; git rebase --continue

或更简单的解决方案是强制将其推送并重新编写自述文件

git push origin master --force

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...