Menu

1 / 2

Solving Claude Code's gh Command Permission Prompts with a Readonly Wrapper

DEV Community·shibayu36·6 months ago
#ASgSOydC
#ai#claude#github#programming#ghro
Reading 0:00
15s threshold

(This is an English translation of my original Japanese article: 日本語版はこちら: https://blog.shibayu36.org/entry/2026/03/09/173000 )

When I use gh api from Claude Code to fetch information from GitHub, a permission prompt pops up every single time, which is painful. Even a harmless command like the one below — just listing commits — needs my approval each run.

gh api "repos/anthropics/claude-code/commits?per_page=100&page=1"

Enter fullscreen mode

Exit fullscreen mode

But blanket-allowing gh api for convenience feels scary. The gh command can also do write operations like creating issues or merging PRs, so there's a real risk of unintended changes. I kept thinking: I wish I could allow only readonly operations.

While looking for a workaround, I found that the gh command supports switching profiles via the GH_CONFIG_DIR environment variable.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.