Auto-install GitHub CLI (gh) for Claude Code web/remote sessions
npm install @jonchurch/claude-code-ghClaude Code web sessions run on ephemeral VMs without the GitHub CLI (gh). If you're used to having Claude work with gh locally, you won't be able to in web sessions.
This package fixes that by installing gh automatically when your session starts.
> [!NOTE]
> Hopefully Anthropic will add the gh cli as installed software on their default iamges, then this package will not be necessary and can be archived.
Remote sessions only see repo-level settings. Add to .claude/settings.json in your repo:
``json`
{
"hooks": {
"SessionStart": [
{
"matcher": "startup",
"hooks": [
{
"type": "command",
"command": "npx @jonchurch/claude-code-gh"
}
]
}
]
}
}
Commit and gh will be available in your next web session.
Running npx on every session start means executing code from npm that you don't control. If you'd rather call a script under your own version control:
`bash`
npx @jonchurch/claude-code-gh install
This copies the script to .claude/hooks/ and updates your settings to use it. Commit both and you're set.
Requires "Full" network access, or "Custom" with release-assets.githubusercontent.com allowed. ("Limited" won't work - GitHub downloads redirect to that domain.)
For private repos or higher rate limits, add GH_TOKEN` to your environment variables.
MIT