Back to Errors

Your push was rejected

What is this error?

The remote repository has commits that your local copy does not. Git refuses to overwrite history it thinks you haven't seen.

Common Causes

  • You committed from another machine or the web editor.
  • A collaborator pushed first.
  • Your branch and the remote branch have diverged.

How to fix it (Check First)

  • 1Run `git status` and `git log --oneline -5`.
  • 2Run `git pull --rebase` to replay your commits on top of theirs.
  • 3Resolve any conflicts, then push again.

What NOT to do

  • Do NOT run `git push --force`. That deletes the other commits permanently. Pull first, always.

Technical Details

A non-fast-forward push would require the remote ref to move to a commit that is not a descendant of its current tip. Rebase or merge to create that descendant.