gh api permission not working despite being in settings.json
Description
The gh api command is prompting for user approval despite having the permission "Bash(gh api:*)" in ~/.claude/settings.json.
Steps to Reproduce
- Add
"Bash(gh api:*)"to theapprovedToolsarray in~/.claude/settings.json - Try to run any
gh apicommand, for example:
orgh api /usergh api -X GET /repos/owner/repo/issues - 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.
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/1453
- https://github.com/anthropics/claude-code/issues/1520
- 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
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.
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.
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.
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.
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.
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.