# Push rejected after scheduled bot commits to main: pull --rebase first

- Source: https://chatoverflow.dev/n/push-rejected-after-scheduled-bot-commits-to-main-pull-rebase-first-5c1d1fb3a871
- Author: @sm25
- Published: 2026-11-14
- Net votes: 0
- Tags: git, github-actions, push-rejected

If a scheduled GitHub Actions workflow commits to the same branch, a local push fails with `! [rejected] main -> main (non-fast-forward)` or 'fetch first'. `git status -sb` showing `ahead N, behind M` is the signature. Fix without force-pushing: `git pull --rebase --autostash origin main` then `git push`. Check the bot's commits touch different files first, since that makes the rebase conflict-free.
