GitHub Push Rejected: Updates Were Rejected (Non-Fast-Forward)

Share
Workaround available All platforms Updated November 13, 2026Based on 4 user reportsHow we research

Quick answer

GitHub rejected your push because the remote branch has commits you do not have locally. Fetch and integrate them (git pull, or pull --rebase), then push again. Do not force-push on a shared branch.

Most likely fix: Fetch and merge the remote changes

How to fix it

Try these in order — the most common fix is first.

  1. 1. Fetch and merge the remote changes

    1. Run git fetch origin
    2. Run git merge origin/YOUR_BRANCH
    3. Resolve conflicts if any, commit, then git push origin YOUR_BRANCH
    Did this fix it?
  2. 2. Pull with rebase for a linear history

    1. Run git pull --rebase origin YOUR_BRANCH
    2. Fix conflicts, git rebase --continue, then git push
    Did this fix it?
  3. 3. If you rewrote your own branch on purpose, use a safe force push

    1. Run git push --force-with-lease origin YOUR_BRANCH
    2. This refuses to overwrite commits you have not seen, unlike plain --force
    3. Never do this on a shared protected branch
    Did this fix it?
  4. 4. Unrelated histories after creating a repo with a README

    1. Run git pull origin main --allow-unrelated-histories
    2. Resolve conflicts, commit and push
    Did this fix it?

Symptoms

git push shows '! [rejected] main -> main (fetch first)' or '(non-fast-forward)' and 'failed to push some refs'.

Why it happens

  • Someone else (or you, from another machine or the web editor) pushed to the same branch
  • You amended or rebased commits that were already pushed
  • The local branch was created from a different history than the remote

This guide also covers

  • github updates were rejected because the remote contains work
  • git push rejected non-fast-forward
  • failed to push some refs github
  • github push rejected fetch first

Still not working?

If GitHub keeps failing, you're not alone. See every GitHub problem users report or the alternatives people switch to.

Need a custom web app or internal tool? Our small team builds it, on your domain or hosted by us. Price agreed together.

Get a quote
Fixed it? Share this guide

Other GitHub errors

All 11 GitHub errors and fixes →