gh api permission not working despite being in settings.json

Status Closed — not planned
Maintainer reply None cached
Activity 7 comments · opened Aug 4, 2025 · closed Jan 13, 2026

Description

The gh api command is prompting for user approval despite having the permission "Bash(gh api:*)" in ~/.claude/settings.json.

Steps to Reproduce

  1. Add "Bash(gh api:*)" to the approvedTools array in ~/.claude/settings.json
  2. Try to run any gh api command, for example:

``bash
gh api /user
`
or
`bash
gh api -X GET /repos/owner/repo/issues
``

  1. Claude Code still prompts for approval despite the permission being set

Expected Behavior

Commands matching gh api:* should execute without prompting, similar to how other gh permissions work (e.g., gh pr view:*)

Actual Behavior

The user is prompted to approve the command execution

Environment

  • Platform: darwin
  • OS Version: Darwin 24.5.0

Additional Context

Other similar permissions in the same settings.json file work correctly:

  • "Bash(gh pr checkout:*)"
  • "Bash(gh pr checks:*)"
  • "Bash(gh pr diff:*)"
  • "Bash(gh pr view:*)"

The permission format appears correct and consistent with working permissions.

View original on GitHub ↗

7 Comments

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/1453
  2. https://github.com/anthropics/claude-code/issues/1520
  3. https://github.com/anthropics/claude-code/issues/2983

If your issue is a duplicate, please close it and 👍 the existing issue instead.

🤖 Generated with Claude Code

tulensrma · 1 year ago

I have this same issue with gh issue commands. I have to approve gh issue create every single time.

I have Bash(gh issue:*) in the project's allow array in settings.local.json and I have tried to add the same to the allowedTools array in ~/claude.json but the array gets emptied every time I open Claude CLI.

payam-pawapay · 1 year ago

Same problem here. I eventually found out that the issue is with the backtick "`" character. Creating an issue without having the backtick (either single or triple) worked for me.

github-actions[bot] · 10 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

ed-irl · 10 months ago

I think I'm experiencing a slightly different variation of this issue - gh api commands are not auto-authorized when allowed via a slash-command's allowed-tools section.

github-actions[bot] · 9 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 8 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.