Fix · GitHub and Git
Git push rejected: the remote has work I do not have
Blocks your work
What you may see
- My push is refused and it says the remote contains work I do not have locally
- It says non-fast-forward or "updates were rejected"
- It worked yesterday, today it fails after someone else (or another computer) pushed
Most likely cause
The online copy has newer saved changes (commits) than your computer, so Git refuses to overwrite them.
Check first (about two minutes)
- Run git status and check you are on the branch you think you are on.
- Run git fetch and then git log HEAD..origin/main --oneline (use your branch name) to see the new work.
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- Run git status, git branch --show-current and git remote -v, and show me the output.
- Run git fetch, then list the commits that are on the remote but not on my computer, and explain them in plain words.
- Make a safety copy first: git branch backup-before-pull.
- Bring the remote work in with git pull --rebase (or git pull if you explain why that is better here). If Git reports a conflict, stop and walk me through it.
- Run the project's build or tests, then git push (a normal push, never a forced one).
Do not do this
- Do not add --force "just to make it go through": it can erase other people's work.
- Do not delete the project folder and clone again before saving your own changes.
- Do not use git push --force or --force-with-lease.