Skip to content

GitHub CLI

43.1k stars
official open-source Has MCP macOS Linux Windows Actively maintained

GitHub's official command-line tool. Manage pull requests, issues, repositories, and Actions workflows without leaving the terminal.

GitHub CLI has both a CLI and an MCP server. See when to use each

When to use

GitHub CLI is the fastest way to interact with GitHub from your terminal. If you use GitHub daily, gh eliminates the context-switching tax of opening a browser to create pull requests, review code, or manage issues.The real power is in workflows that chain multiple operations. Creating a branch, pushing it, opening a PR, requesting reviewers, and linking an issue — that's five browser tabs or one gh command. For CI/CD debugging, gh run watch streams workflow logs in real time, which is faster than refreshing the Actions tab.Agent compatibility makes gh especially valuable for AI-assisted development. Claude Code, Cursor, and Windsurf can all invoke gh commands directly, making pull request creation, issue management, and CI monitoring automatable from within your editor. The CLI's scriptability means agents can compose complex GitHub operations from simple, predictable commands.For teams, gh standardizes GitHub workflows across the org. New developers can follow the same PR creation flow whether they use VS Code, a terminal, or an AI coding agent. The extension ecosystem adds custom commands for org-specific workflows like release management and deployment tracking.Install it on every machine where you write code. The auth flow takes 30 seconds, and the muscle memory pays dividends within a day.

When to skip

Skip gh if you don't use GitHub. GitLab users should use glab, and Bitbucket users should look at the Atlassian CLI tools. The gh CLI is GitHub-only by design — it authenticates against GitHub's API and has no support for other Git hosting platforms.If your workflow is purely visual — you prefer the GitHub web UI for code review, you like drag-and-drop project boards, or you rarely touch the terminal — gh won't change your habits. It's a power-user tool that rewards terminal fluency. The web UI still offers features gh cannot replicate, including organization settings, billing management, and GitHub App configuration.For simple git operations like commit, push, and pull, you don't need gh. Standard git handles version control. gh is the GitHub platform layer on top of git, not a replacement for it. If your daily workflow is just committing and pushing code, git alone is sufficient.If you work in a locked-down corporate environment where CLI tools require security approval, the setup overhead may not be worth it for occasional GitHub use. The web UI requires no installation and works behind most firewalls. Similarly, if you only interact with GitHub a few times a month, the learning curve of gh commands may not justify the investment.

Key Commands

gh pr create Create a pull request from the current branch
gh pr merge Merge a pull request and clean up the branch
gh issue create Create a new issue with labels and assignees
gh repo clone Clone a repository to your local machine
gh run watch Watch a GitHub Actions workflow run in real time
gh copilot suggest Get AI-powered command suggestions from GitHub Copilot
gh api Make authenticated requests to the GitHub API

GitHub Stats

repo cli/cli
stars 43.1k
language Go
license MIT
last commit Mar 12, 2026

Alternatives

tool description
GitHub CLI current tool
hub The original GitHub CLI by Chris Wanstrath. Predecessor to gh, now in maintenance mode.

FAQ

Is GitHub CLI free?
Yes. GitHub CLI is free and open-source under the MIT license. It works with GitHub Free, Pro, Team, and Enterprise accounts. All features are available on every plan.
How do you authenticate GitHub CLI?
Run gh auth login and follow the prompts. You can authenticate via browser (OAuth) or paste a personal access token. For CI/CD, set the GH_TOKEN environment variable. Authentication persists until you run gh auth logout.
Can GitHub CLI replace the GitHub website?
For most developer workflows, yes. You can create and merge PRs, manage issues, trigger workflows, browse repos, and query the API. You cannot manage organization settings, billing, or GitHub Apps from the CLI.
Does GitHub CLI work with GitHub Enterprise?
Yes. Run gh auth login --hostname your-enterprise.github.com to authenticate against your Enterprise instance. All commands work the same way. You can be authenticated to multiple GitHub instances simultaneously.
What is the difference between git and gh?
git is the version control system that manages commits, branches, and merges locally. gh is the GitHub platform layer that manages pull requests, issues, Actions, and repos. You use both together — git for version control, gh for GitHub-specific operations.

Last verified: Mar 14, 2026