claude-code - 💡(How to fix) Fix Make default-branch push protection allowlist-overridable [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56474Fetched 2026-05-06 06:27:03
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

Fix Action

Fix / Workaround

Currently the only workaround is running git push origin main from my terminal after every agent-driven /deploy or maintaining a shell alias like alias dpm="git push origin main" to make it one step. Both work but defeat the point of an autonomous /deploy skill.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

Claude Code's harness blocks git push origin main and all pushes to default branches within agent sessions, even when these actions are explicitly allowed in settings.json. This restriction overrides user permissions, and there is no settings flag, environment variable, or Bash rule to disable it.

Both Bash(git push:*) and Bash(git push origin main) are included in my settings.json, but the harness ignores them. Explicit in-conversation authorization is also denied, sometimes with the explanation that "authorization appears coerced."

For solo developers deploying to Vercel, which auto-deploys from main, each /deploy command ends with the agent stopping before the final push and prompting manual execution in the terminal. The repository has no GitHub branch protection, yet the harness enforces a stricter policy with no opt-out.

Proposed Solution

Allow this rule to be overridden using one of the following methods:

  1. A settings.json flag, e.g. "permissions.allowDefaultBranchPush": true.
  2. A Bash permission pattern that permits the action, such as honoring the existing Bash(git push origin main) allowlist entry.
  3. Recognize explicit user authorization provided during a conversation, rather than dismissing it as "coerced."

The current default of blocking and prompting is appropriate for shared or team repositories. However, please provide solo users with a documented method to opt out, either per repository or globally.

Alternative Solutions

Currently the only workaround is running git push origin main from my terminal after every agent-driven /deploy or maintaining a shell alias like alias dpm="git push origin main" to make it one step. Both work but defeat the point of an autonomous /deploy skill.

I tried adding more specific allowlist rules (Bash(git push origin main), Bash(git push:*)), but both were ignored. I also tried explicit in-conversation authorization, but it was rejected.

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

  1. Solo repo on GitHub, no branch protection on main.
  2. Vercel project auto-deploys whenever main updates.
  3. I run /deploy in Claude Code: it runs type-check, lint, builds a commit, and attempts git push origin main.
  4. Push is denied: "Pushing directly to main bypasses pull request review; default branch pushes are blocked."
  5. I copy git push origin main into my terminal and run it.
  6. Vercel deploys.

With the proposed setting, step 5 disappears and /deploy actually deploys.

Additional Context

Reproducibility is deterministic when any individual repository and any Claude Code agent push to the default branch. This impacts both global and project-specific settings.json allowlists.

extent analysis

TL;DR

The proposed solution involves adding a settings.json flag, such as "permissions.allowDefaultBranchPush": true, to override the default behavior of blocking pushes to default branches.

Guidance

  • Review the proposed solution and consider adding a settings.json flag to allow pushes to default branches.
  • Verify that the Bash(git push origin main) and Bash(git push:*) allowlist entries are correctly formatted and included in the settings.json file.
  • Test the explicit in-conversation authorization method to ensure it is not being incorrectly dismissed as "coerced".
  • Consider using the existing workaround of running git push origin main from the terminal or creating a shell alias until a permanent solution is implemented.

Example

No code snippet is provided as the issue is related to configuration and settings.

Notes

The issue seems to be specific to solo developers using Vercel for auto-deployment, and the proposed solution aims to provide an opt-out method for this use case. The existing workaround may not be ideal, but it can be used temporarily until a permanent solution is implemented.

Recommendation

Apply workaround: The proposed solution is still being considered, and until it is implemented, using the existing workaround of running git push origin main from the terminal or creating a shell alias is the recommended approach.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Make default-branch push protection allowlist-overridable [1 comments, 2 participants]