git
runtime_error
ai_generated
true
错误:无法将一些引用推送到 'origin' 提示:更新被拒绝,因为远程包含您本地没有的工作。
error: failed to push some refs to 'origin' hint: Updates were rejected because the remote contains work that you do not have locally.
ID: git/push-non-fast-forward
88%修复率
87%置信度
1证据数
2023-04-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| git 2.31.0 | active | — | — | — |
| git 2.39.0 | active | — | — | — |
| git 2.44.0 | active | — | — | — |
根因分析
本地分支落后于远程分支;拒绝推送以防止覆盖远程更改。
English
Local branch is behind the remote branch; push is rejected to prevent overwriting remote changes.
官方文档
https://git-scm.com/docs/git-push解决方案
-
Pull the remote changes first: 'git pull origin main --rebase' to rebase local commits on top, then push again.
-
If conflicts occur, resolve them manually, then continue the rebase with 'git rebase --continue' and push.
无效尝试
常见但无效的做法:
-
70% 失败
Using 'git push --force' may overwrite remote commits and cause data loss for collaborators.
-
50% 失败
Running 'git pull' without merging may result in merge conflicts if not handled properly.