首页 > 代码库 > Git push 报错 "error: failed to push some refs to " 解决

Git push 报错 "error: failed to push some refs to " 解决

之前一直好好地啊,google后,发现是由于远程仓库中代码版本与本地不一致冲突导致的。 
突然想起来,确实我在云端直接改过README,解决方法,先pull,再push,然而这时候又出现了新的问题, 
error: Your local changes to the following files would be overwritten by merge: 
Please, commit your changes or stash them before you can merge. 
这时候我想用云端覆盖本地,

git fetch --allgit reset --hard origin/master

Git fetch 只是下载远程的库的内容,不做任何的合并 git reset 把HEAD指向刚刚下载的最新的版本 
OK,现在就正常了,再push就没有问题了

Git push 报错 "error: failed to push some refs to " 解决