Skip to content

Enable `gh` command in Claude Code on the Web environment, just adding SessionStartHooks

License

Notifications You must be signed in to change notification settings

oikon48/gh-setup-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh-setup-hooks

npm version License: MIT

Auto-install GitHub CLI on Claude Code on the Web. Just add one line to settings.json.

Setup

1. Add hook to settings.json

Add to .claude/settings.json:

{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "bun x gh-setup-hooks",
            "timeout": 120
          }
        ]
      }
    ]
  }
}

npx -y gh-setup-hooks is also ok.

2. Set up Claude Code on the Web

To use gh commands (e.g., gh pr create), you need to set GH_TOKEN or GITHUB_TOKEN:

  1. Go to Claude Code on the Web
  2. Open SettingsCustom Environment
  3. Add environment variable:

Note: The token needs repo scope for most operations.

Claude Code on the Web network should be Full or Custom. If using Custom, you need to allow release-assets.githubusercontent.com.

Cloud Environment Settings

How It Works

  1. Start a session on Claude Code on the Web
  2. SessionStart hook runs npx gh-setup-hooks
  3. Installs gh only in remote environment (CLAUDE_CODE_REMOTE=true)
  4. Installs to ~/.local/bin and persists PATH
  5. Does nothing in local environment

Configuration

Environment Variable Description Default
GH_SETUP_VERSION gh version to install 2.83.2

License

MIT

References

About

Enable `gh` command in Claude Code on the Web environment, just adding SessionStartHooks

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •