Regular git push to main blocked even with explicit user approval

Resolved 💬 2 comments Opened Feb 2, 2026 by ae-robertsanchez Closed Mar 3, 2026

Description

Claude Code blocks regular git push origin main commands even when:

  1. The user explicitly requests the push
  2. GitHub branch protection has been removed
  3. Project-level .claude/settings.json is configured to allow it

The error message shown:

🚫 Blocked push from protected branch: main
   Create/switch to a feature branch and push that instead.

Expected Behavior

According to the documented Git Safety Protocol, only force push to main/master should be blocked:

"NEVER run force push to main/master, warn the user if they request it"

A regular git push (non-force) should be allowed, especially when the user explicitly requests it.

Actual Behavior

All pushes to main are blocked, including regular (non-force) pushes with explicit user approval.

Use Case

Personal/operational repositories where the user is the sole contributor. The branch→PR→merge ceremony adds unnecessary friction for repos like:

  • Personal dotfiles
  • Ops/automation repos
  • Solo projects

Reproduction Steps

  1. User asks Claude to commit and push changes
  2. Claude commits successfully
  3. Claude attempts git push origin main
  4. Push is blocked with the error above
  5. Even after removing GitHub branch protection, the block persists
  6. Even after adding project settings to allow push, the block persists

Suggested Fix

Either:

  1. Only block git push --force to main (as documented), not regular push
  2. Allow project-level settings to override this protection
  3. Allow the push when user explicitly approves it

Environment

  • Claude Code CLI
  • macOS
  • Repository: private personal ops repo

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗