Terminal

! [rejected] main -> main (non-fast-forward) — error: failed to push some refs

What it means
GitHub has newer commits that aren't on your computer yet, so Git stopped the push to protect you from overwriting them.
Likely causes
  • A pull request was merged on GitHub (or you worked on another computer) since your last pull.
  • Pushing directly to main instead of pulling first or working on a feature branch.
Prevention
Pull at the start of every session and build each task on its own branch.

Copy for your agent

GitHub rejected my push with `non-fast-forward`. Pull the remote changes first, explain any conflict in plain words before resolving it, and push again. Never force-push.

Full help articleGitHub rejected your push

Last reviewed Nov 8, 2026