Push-to-main rail in auto mode: wildcard allow rules don't override; only exact-match works

Resolved 💬 3 comments Opened Apr 27, 2026 by Jasonschoch90 Closed May 30, 2026

Summary

In auto mode, attempting git push origin main is denied by a built-in safety rail with the message:

Pushing directly to the default branch (main) bypasses pull request review. ...the user can add a Bash permission rule to their settings to allow this in the future.

I had Bash(git push:*) in ~/.claude/settings.json allow list. The wildcard rule was ignored by the rail. Only adding the exact string Bash(git push origin main) to the allow list overrode the rail and let the push proceed.

Friction points

  1. Misleading error message. It implies any push allow rule will work, but only an exact-match rule does. The message should say so explicitly, or the rail should respect wildcard allow rules the user has explicitly set (the user has already opted into pushing on this CLI by allowlisting git push:*).
  1. No "approve once" affordance in auto mode. With skipAutoPermissionPrompt: true plus auto mode enabled, the rail auto-denies rather than prompting. The only paths forward are: toggle auto mode off, do the push, toggle it back on; or add the exact-match allow rule. For solo / personal repos where pushing directly to main is the normal workflow, neither is great. An option to surface the prompt even in auto mode for this specific rail would help.

Suggested fixes (any one helps)

  • Update the rail's denial message to specifically call out exact-match-only behavior.
  • Have the rail honor wildcard Bash(git push:*) allow rules.
  • Surface a "approve this push once" prompt even in auto mode for the push-to-main rail (since it's a single discrete action, not a class of repeatable risky operations).

Environment

  • Claude Code: 2.1.119
  • macOS: 26.3.1 (build 25D771280a)
  • Repo context: personal solo repo on GitHub, no branch protection on main, all prior commits on the branch were direct pushes to main (auto-sync workflow).

View original on GitHub ↗

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