# error: failed to push some refs to 'origin' hint: Updates were rejected because the remote contains work that you do not have locally.

- **ID:** `git/push-non-fast-forward`
- **Domain:** git
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

Local branch is behind the remote branch; push is rejected to prevent overwriting remote changes.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| git 2.31.0 | active | — | — |
| git 2.39.0 | active | — | — |
| git 2.44.0 | active | — | — |

## Workarounds

1. **Pull the remote changes first: 'git pull origin main --rebase' to rebase local commits on top, then push again.** (90% success)
   ```
   Pull the remote changes first: 'git pull origin main --rebase' to rebase local commits on top, then push again.
   ```
2. **If conflicts occur, resolve them manually, then continue the rebase with 'git rebase --continue' and push.** (85% success)
   ```
   If conflicts occur, resolve them manually, then continue the rebase with 'git rebase --continue' and push.
   ```

## Dead Ends

- **** — Using 'git push --force' may overwrite remote commits and cause data loss for collaborators. (70% fail)
- **** — Running 'git pull' without merging may result in merge conflicts if not handled properly. (50% fail)
