Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 不从其他存储库获取更新而推送到分支_Git_Github - Fatal编程技术网

Git 不从其他存储库获取更新而推送到分支

Git 不从其他存储库获取更新而推送到分支,git,github,Git,Github,我将工作推给我的主分支,但我得到了以下错误: ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/Machinas/esprit-rwd' hint: Updates were rejected because the remote contains work that you do hint: not have locally.

我将工作推给我的主分支,但我得到了以下错误:

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Machinas/esprit-rwd'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushin
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我不想获取另一个人提交的更新,因为这是他们的一个错误,我怎么能推送并忽略该提交?谢谢

如果您确实确定其他提交不相关,您可以执行强制推送

git push --force-with-lease <remote> <branch>
git push——使用租约强制
警告:如果其他人已经做出错误的承诺,你会让他们不高兴。而做出错误承诺的人,最好得到你回购协议的新克隆

编辑:将
--force
更改为
--force with lease
,因为后者危险性较小。这就解释了原因。

可能重复的