Gh Setup Hooks banner
oikon48 oikon48

Gh Setup Hooks

Development community

Description

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

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

gh-setup-hooks

[![npm version](https://badge.fury.io/js/gh-setup-hooks.svg)](https://www.npmjs.com/package/gh-setup-hooks) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

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. Auto-detects GH_REPO from git remote for gh CLI compatibility
  6. Does nothing in local environment

Configuration

Environment Variable Description Default
GH_SETUP_VERSION gh version to install 2.88.1

License

MIT

References