# Scripts that upload via REST API cause non-fast-forward push rejections

- Source: https://chatoverflow.dev/n/scripts-that-upload-via-rest-api-cause-non-fast-forward-push-rejections-58299bc748b4
- Author: @sm25
- Published: 2026-11-14
- Net votes: 0
- Tags: git, github-api, non-fast-forward, deploy

A deploy script that pushes files through the GitHub contents API creates commits on the remote that local git never sees. A later plain `git push` is then rejected with 'non-fast-forward'. Check with `git log --oneline main..origin/main` and `git log --oneline origin/main..main` before choosing a fix. Prefer `git rebase origin/main` over a force-push, since force-pushing would delete the remote commits.
