Skip to content

Instantly share code, notes, and snippets.

@lukemorton
Last active January 15, 2026 13:49
Show Gist options
  • Select an option

  • Save lukemorton/9bb3a50989170da99ec56df2f978e65b to your computer and use it in GitHub Desktop.

Select an option

Save lukemorton/9bb3a50989170da99ec56df2f978e65b to your computer and use it in GitHub Desktop.
Install Github CLI Tool on Claude Code Cloud

Install Github CLI Tool on Claude Code Cloud

Ever get annoyed that Claude Code can't open Github PRs, update PR description, or work with issues? Well now we can.

This is a guide specifically for the web and mobile-based Claude Code Cloud.

How this works

Claude Code Cloud doesn't ship with the gh command line tool for working with issues, pull requests and other data.

This script bootstraps the Claude Code Cloud environment by installing the gh tool on startup.

Setup

  • Add claude-web-setup.sh to your project
  • Add SessionStart hook to your .claude/settings.json
  • Add the below to your Claude Code Cloud environment
WITH_GH_CMD=true                # required to toggle installation of `gh` on
GH_TOKEN=BLAH                   # personal token with appropriate permissions
GH_REPO=anthropic/claude-code   # optional but shortcuts which repo `gh` uses

Using gh tool

You can now ask Claude Code to read or create issues, generate pull requests, etc.

You can simply ask Claude Code to look at issues, or instruct it specifically to use the gh tool.

Opting in to installing the tool

Because gh installation adds a few seconds, you may want to opt into this. I've done this by creating a specific Claude Code Cloud environment that has the WITH_GH_CMD=true in.

If that flag is missing, gh won't be installed.

#!/bin/bash
set -e
# Only run in Claude Code web environment
if [ "$CLAUDE_CODE_REMOTE" != "true" ]; then
exit 0
fi
# Install gh CLI if flag is set and gh not present
if [ "$WITH_GH_CMD" = "true" ] && ! command -v gh &> /dev/null; then
echo "Installing GitHub CLI..."
BASE_URL="http://archive.ubuntu.com/ubuntu/pool/universe/g/gh"
LATEST_DEB=$(curl -x "$HTTPS_PROXY" -sL "$BASE_URL/" \
| grep -oP 'href="gh_[^"]+_amd64\.deb"' \
| sed 's/href="//;s/"//' \
| sort -V | tail -1)
if [ -n "$LATEST_DEB" ]; then
curl -x "$HTTPS_PROXY" -sL "$BASE_URL/$LATEST_DEB" -o /tmp/gh.deb
dpkg -i /tmp/gh.deb 2>/dev/null || sudo dpkg -i /tmp/gh.deb
rm /tmp/gh.deb
echo "Installed: $(gh --version | head -1)"
fi
fi
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "bash ./claude-web-setup.sh"
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment