Skip to main content
With a GitHub token configured, Claude can clone private repositories, push commits, and create pull requests using Git and the GitHub CLI (gh).
GitHub integration is built on Secrets. The catty secrets add github command provides a guided setup specifically for GitHub tokens.

Setup

Run the guided setup:
catty secrets add github
This will:
  1. Open GitHub’s token creation page in your browser
  2. Prompt you to paste the generated token
  3. Validate the token works
  4. Save both GITHUB_TOKEN and GH_TOKEN (for compatibility)

Required Token Scopes

When creating the token on GitHub, select:
  • repo - Full control of private repositories
This is sufficient for most workflows. Add more scopes only if needed.

What Claude Can Do

With a GitHub token, Claude can:
ActionExample Command
Clone private reposgit clone https://github.com/yourorg/private-repo
Push commitsgit push origin main
Create branchesgit checkout -b feature-branch
Create pull requestsgh pr create --title "Add feature"
Manage issuesgh issue create --title "Bug report"
Review PRsgh pr view 123

Example Session

# Start a session (GitHub token is automatically passed)
catty new --no-upload

# Claude can now work with your private repos
> Clone https://github.com/yourorg/my-app and add a new API endpoint

# Claude runs:
git clone https://github.com/yourorg/my-app
cd my-app
# ... makes changes ...
git add .
git commit -m "Add new API endpoint"
git push origin main
gh pr create --title "Add new API endpoint" --body "..."

Verifying Setup

Test your token:
catty secrets test github
Output:
Testing GitHub token...
✓ Token valid (user: yourname)

Token Storage

The token is stored encrypted at ~/.catty/secrets.json using AES-256-GCM. It’s only decrypted when starting a session and sent over HTTPS. See Secrets for encryption details.

Session Environment

Inside the session:
# Both variables are set
echo $GITHUB_TOKEN
echo $GH_TOKEN

# gh CLI auto-detects the token
gh auth status
# → Logged in to github.com as yourname

Updating Your Token

# Remove old token
catty secrets remove GITHUB_TOKEN

# Add new token
catty secrets add github

Revoking Access

If you need to revoke access:
  1. Go to GitHub → Settings → Developer settings → Personal access tokens
  2. Revoke the token
  3. Remove from Catty: catty secrets remove GITHUB_TOKEN

See Also