OpenClaw Manual OpenClaw
Git & GitHub Recommended

GitHub (gh) Skill for OpenClaw

Operate GitHub via the gh CLI (issues, PRs, repos).

Last updated : 2026-03-01

Quick Install

$ npx clawhub@latest install github

Key Features

Create and manage pull requests with natural language
Open, label, and close issues automatically
Review code diffs and suggest improvements
Search repositories, commits, and code
Manage GitHub Actions workflows
Browse and compare branches

OpenClaw GitHub Skill Overview

The GitHub (gh) skill connects OpenClaw to the GitHub platform via the official GitHub CLI (gh) . Once installed, your OpenClaw agent can interact with repositories, pull requests, issues, Actions workflows, and more — using plain English commands.

This is one of the most popular and versatile skills in the OpenClaw ecosystem. Whether you are triaging issues, opening PRs, or checking CI status, the GitHub skill turns multi-step Git workflows into simple conversations.

Typical workflow:

  1. Ask OpenClaw to check your open PRs.
  2. The agent runs gh pr list under the hood.
  3. Results are returned in a readable summary — no context-switching required.

Prerequisites for GitHub Skill

Before installing the GitHub skill, make sure you have:

  • OpenClaw installed and running (v1.0+)
  • GitHub CLI (gh) installed — installation guide
  • A GitHub account with access to the repositories you want to manage
  • clawhub CLI installed for skill management

Verify your setup:

bash
# Check OpenClaw version
openclaw --version

# Check GitHub CLI version
gh --version

# Verify GitHub authentication
gh auth status

How to Install the GitHub Skill

Install the GitHub skill with a single command:

bash
npx clawhub@latest install github

To verify the installation:

bash
clawhub list

You should see github in the list of installed skills.

GitHub Skill Configuration

The GitHub skill requires a Personal Access Token (PAT) or GitHub CLI authentication. We recommend using gh auth login for the simplest setup.

Token Scopes

If you prefer a PAT, create one at github.com/settings/tokens with these scopes:

| Scope | Required | Purpose | |-------|----------|---------| | repo | Yes | Full access to repositories | | read:org | Recommended | Read organization membership | | workflow | Optional | Manage GitHub Actions workflows | | read:project | Optional | Read project boards | | gist | Optional | Create and manage gists |

Environment Setup

bash
# Option 1: Use GitHub CLI authentication (recommended)
gh auth login

# Option 2: Set a Personal Access Token
export GITHUB_TOKEN=ghp_your_token_here

Important: Never hardcode tokens in configuration files. Use environment variables or a secret manager (such as 1Password or Bitwarden).

GitHub Skill Usage Examples

1. List and Triage Open Issues

You: "Show me the open issues on our main repo labeled bug ."

The agent runs the equivalent of gh issue list --label bug --state open and returns a formatted summary with issue numbers, titles, and assignees.

You: "Assign issue #42 to me and add the priority:high label."

The agent executes gh issue edit 42 --add-assignee @me --add-label priority:high .

2. Create a Pull Request

You: "Create a PR from the feature/auth branch to main with title 'Add OAuth2 login' and a summary of the changes."

The agent stages the PR using gh pr create , fills in the title, and generates a description based on the commit diff.

3. Review a Pull Request

You: "Summarize the changes in PR #128."

The agent fetches the diff with gh pr diff 128 , analyzes the changes, and provides a concise summary covering:

  • Files changed and lines added/removed
  • Key logic changes
  • Potential concerns or suggestions

4. Check CI Status

You: "What's the status of the latest Actions run on main ?"

The agent checks gh run list --branch main --limit 1 and reports whether the run passed, failed, or is still in progress — along with a link to the full log.

Security & Best Practices

The GitHub skill can perform write operations on your repositories. Follow these guidelines to stay safe:

  • Use least privilege. Grant only the token scopes you actually need. If you only read repos, skip the workflow scope.
  • Authenticate via gh auth login instead of long-lived PATs when possible. The CLI handles token refresh automatically.
  • Review before merging. Always confirm PR merges and destructive actions. OpenClaw will prompt for approval by default.
  • Rotate tokens regularly. If you use a PAT, set an expiration date and rotate it at least every 90 days.
  • Avoid granting admin scope. The admin:org and delete_repo scopes are rarely needed. Do not grant them unless required.
  • Audit activity. Check your GitHub audit log periodically to review actions performed via the API.

Troubleshooting Common Errors

"gh: command not found"

The GitHub CLI is not installed or not in your PATH.

bash
# macOS
brew install gh

# Ubuntu / Debian
sudo apt install gh

# Windows
winget install GitHub.cli

After installing, authenticate with gh auth login .

"HTTP 401: Bad credentials"

Your token is missing, expired, or lacks the required scopes.

  1. Run gh auth status to check the current authentication state.
  2. If expired, re-authenticate with gh auth login .
  3. If using a PAT, verify it has the repo scope at github.com/settings/tokens .

"Resource not accessible by integration"

You are trying to access a repository or organization that your token does not have permission for.

  1. Check that your token includes the read:org scope.
  2. Confirm your GitHub account has access to the target repository.
  3. For organization repos, an admin may need to approve your token under Settings → Third-party access .

FAQ

Yes, when configured properly. The skill follows OpenClaw's confirmation model — destructive actions (merges, deletions, force-pushes) require your explicit approval before execution. We recommend starting with read-only scopes and adding write permissions only as needed. Always review the agent's proposed actions before confirming.

Yes. The GitHub CLI supports Enterprise Server and GitHub Enterprise Cloud. Run `gh auth login --hostname your-enterprise-host.com` to authenticate against your Enterprise instance. The skill will automatically use the configured host for all subsequent operations.

The GitHub skill provides broad GitHub platform access — issues, PRs, Actions, repos, and more. The PR Reviewer skill is specialized for in-depth code review: it analyzes diffs line by line, checks for common patterns, and provides structured feedback. For the best experience, install both and let OpenClaw pick the right tool for each task.

Related Skills

Conventional Commits
Recommended

Generate/validate Conventional Commits messages.

PR Reviewer
Recommended

Automated code review for pull requests.

Git Workflows
Recommended

Advanced git workflows (rebase/cherry-pick/cleanup).

Install on ClawHub Back to Skills Directory