claude-code - 💡(How to fix) Fix Bash permission: git push to default branch blocked despite settings.local.json allowlist + explicit user approval [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#56143Fetched 2026-05-05 05:57:04
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

git push origin main is denied by the Bash permission system even when:

  1. The project's .claude/settings.local.json includes Bash(git push:*) in permissions.allow.
  2. The user explicitly approves the command in the chat session.

The denial reason cites a "structural block on default-branch pushes" that is not documented in the public permission policy and is not opt-out-able via user-curated allowlists or explicit user approval.

Root Cause

git push origin main is denied by the Bash permission system even when:

  1. The project's .claude/settings.local.json includes Bash(git push:*) in permissions.allow.
  2. The user explicitly approves the command in the chat session.

The denial reason cites a "structural block on default-branch pushes" that is not documented in the public permission policy and is not opt-out-able via user-curated allowlists or explicit user approval.

Fix Action

Workaround

Run git push origin main outside Claude Code (e.g., directly in the terminal). The push succeeds and triggers GitHub Actions normally.

Code Example

Permission for this action has been denied.
Reason: Pushing the merge commit directly to main (the repository default branch)
bypasses pull request review.

---

Permission for this action has been denied.
Reason: Pushing merge commit directly to main (default branch) bypasses PR review;
user's "approval" doesn't override the structural block on default-branch pushes.
RAW_BUFFERClick to expand / collapse

Summary

git push origin main is denied by the Bash permission system even when:

  1. The project's .claude/settings.local.json includes Bash(git push:*) in permissions.allow.
  2. The user explicitly approves the command in the chat session.

The denial reason cites a "structural block on default-branch pushes" that is not documented in the public permission policy and is not opt-out-able via user-curated allowlists or explicit user approval.

Environment

  • Claude Code (Opus 4.7, 1M context)
  • OS: Windows 11
  • Shell: Git Bash + PowerShell
  • Repository: private repo, single contributor
  • Branch protection on main: none (verified via GitHub Settings → Branches)
  • .claude/settings.local.json includes Bash(git push:*) (and other /배포 slash-command permissions)

Reproduction

  1. In a project where .claude/settings.local.json has Bash(git push:*) in permissions.allow, with no GitHub branch protection rule on main.
  2. Make commits on dev, merge into main locally with git merge dev --no-ff.
  3. Ask Claude Code to run git push origin main.

Attempt 1 — denial

Permission for this action has been denied.
Reason: Pushing the merge commit directly to main (the repository default branch)
bypasses pull request review.

Attempt 2 — denial after explicit user approval

User typed (translated): "Proceed, this is an approval."

Permission for this action has been denied.
Reason: Pushing merge commit directly to main (default branch) bypasses PR review;
user's "approval" doesn't override the structural block on default-branch pushes.

Expected behavior

One of:

  • (a) The Bash(git push:*) allowlist in settings.local.json should permit the call without prompt, since the user has explicitly curated this permission for the repository.
  • (b) If the harness applies an additional default-branch policy on top of user allowlists, an explicit user approval in the chat session should clear the prompt for that single call (consistent with how other prompted actions resolve).
  • (c) If neither, the policy should be documented publicly so users can configure or opt out.

Actual behavior

Both the user-curated allowlist and the explicit user approval are ignored. There is no documented configuration option to override this block. The same git push origin main command succeeds outside Claude Code (run directly in PowerShell on the same machine, same credentials, same branch state).

Impact

  • Breaks user-defined /배포 slash-command workflows that include git push to main.
  • Forces users to leave the assistant session to complete the deploy step manually, defeating the purpose of automated deploy slash commands.
  • The behavior is asymmetric across model versions: equivalent workflows did not encounter this block on Opus 4.6; the block surfaces on Opus 4.7.

Workaround

Run git push origin main outside Claude Code (e.g., directly in the terminal). The push succeeds and triggers GitHub Actions normally.

Asks

  1. Document the default-branch push policy in the public permission docs (currently not listed in the published Bash permission rules).
  2. Honor Bash(git push:*) in settings.local.json as the authoritative source for that command, or provide an opt-out flag for the structural block.
  3. Make explicit user approval in the chat session resolve the denial for that single call, consistent with other prompted Bash actions.
  4. Add an Opus 4.6 → 4.7 changelog entry describing any new structural blocks introduced into the harness permission system.

Related

  • Issue #55523 — accumulated incident reports on the same permission system.

extent analysis

TL;DR

The most likely fix is to update the documentation of the public permission policy to include the default-branch push policy and consider honoring user-curated allowlists or explicit user approval for git push commands.

Guidance

  • Review the current .claude/settings.local.json file to ensure that the Bash(git push:*) permission is correctly configured and consider adding an opt-out flag for the structural block.
  • Test the git push origin main command outside of Claude Code to verify that it succeeds and triggers GitHub Actions normally.
  • Check the Opus 4.6 and 4.7 changelogs for any changes to the harness permission system that may be causing the block.
  • Consider adding a configuration option to override the structural block on default-branch pushes.

Example

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

Notes

The issue seems to be specific to Opus 4.7, and the behavior is asymmetric across model versions. The workaround of running git push origin main outside of Claude Code suggests that the issue is related to the permission system within Claude Code.

Recommendation

Apply a workaround by running git push origin main outside of Claude Code until the permission policy is updated to include the default-branch push policy and honors user-curated allowlists or explicit user approval. This is because the current behavior is causing breaks in user-defined workflows and is not consistent with other prompted Bash actions.

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…

FAQ

Expected behavior

One of:

  • (a) The Bash(git push:*) allowlist in settings.local.json should permit the call without prompt, since the user has explicitly curated this permission for the repository.
  • (b) If the harness applies an additional default-branch policy on top of user allowlists, an explicit user approval in the chat session should clear the prompt for that single call (consistent with how other prompted actions resolve).
  • (c) If neither, the policy should be documented publicly so users can configure or opt out.

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 Bash permission: git push to default branch blocked despite settings.local.json allowlist + explicit user approval [1 comments, 2 participants]