# remote: error: cannot push to a protected ref 'refs/heads/main'

- **ID:** `git/push-delete-refspec`
- **Domain:** git
- **Category:** auth_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Attempt to push to a branch that is protected by repository rules (e.g., GitHub branch protection), requiring pull requests or admin approval.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| git 2.37.0 | active | — | — |
| git 2.41.0 | active | — | — |
| git 2.44.0 | active | — | — |

## Workarounds

1. **Create a new branch, push it, and open a pull request for review: 'git checkout -b feature-branch && git push origin feature-branch'.** (90% success)
   ```
   Create a new branch, push it, and open a pull request for review: 'git checkout -b feature-branch && git push origin feature-branch'.
   ```
2. **Request admin to temporarily disable branch protection, then push.** (60% success)
   ```
   Request admin to temporarily disable branch protection, then push.
   ```

## Dead Ends

- **** — Forcing push with 'git push --force' will be rejected by the remote server. (95% fail)
- **** — Deleting the protected branch locally and pushing again will fail due to remote protection. (90% fail)
