About the GitHub CLI
GitHub CLI is a command-line tool that brings pull requests, issues, GitHub Actions, and other GitHub features to your terminal, allowing you to do all your work in one place.
GitHub CLI includes features like:
View, create, clone, and fork repositories
Create, close, edit, and view issues and pull requests
Review, compare, and merge pull requests
Run, view, and list workflows
Create, list, view, and delete releases
Create, edit, list, view, and delete gists
List, create, delete, and connect to a codespace
Retrieve information from the GitHub API
What is the difference between GitHub CLI and Git on the command line?
The Git command line interface (git
) lets you work with a local or remote Git repository. The remote repository can be hosted on GitHub or another service.
GitHub CLI (gh
) is designed specifically for working with GitHub. It enables you to interact with GitHub through the command line in various ways, as shown in the previous list. If you often work on the command line, you might prefer using GitHub CLI instead of accessing GitHub through a browser. GitHub CLI also simplifies creating scripts to automate GitHub tasks.
Installing GitHub CLI
For instructions on how to install GitHub CLI, visit the GitHub CLI repository and GitHub CLI.
gh
Work smoothly with GitHub using the command line.
gh auth
Authenticate gh
and git
with GitHub
Core Commands
These commands help you manage repositories, issues, pull requests, and other key features of GitHub.
gh browse
Open a GitHub repository, issue, pull request, or discussion in your browser.gh codespace
Work with GitHub Codespaces, including creating, managing, or connecting to a codespace.gh gist
Create, list, edit, or delete GitHub gists.gh issue
Manage GitHub issues: create, view, close, reopen, or comment on issues.gh org
Manage GitHub organizations: list members, view details, and more.gh pr
Manage pull requests: create, view, merge, close, or comment on pull requests.gh project
Work with GitHub Projects: manage project boards and items.gh release
Manage releases: create, edit, delete, or download release assets.gh repo
Interact with GitHub repositories: clone, fork, create, delete, or view information about repositories.
GitHub Actions Commands
These commands are designed to automate workflows and manage GitHub Actions.
gh cache
Manage GitHub Actions cache: list, delete, or view cache details.gh run
View, monitor, or manage GitHub Actions workflow runs.gh workflow
Manage workflows: enable, disable, view, or rerun them.
Additional Commands
These commands handle various administrative, configuration, and utility tasks.
gh alias
Create or manage command shortcuts for the GitHub CLI.gh api
Make direct requests to the GitHub API.gh attestation
Manage security attestations for GitHub releases or artifacts.gh completion
Generate shell completion scripts for the GitHub CLI.gh config
Manage GitHub CLI settings, including authentication and preferences.gh extension
Install, manage, or create GitHub CLI extensions.gh gpg-key
Manage GPG keys: list, add, or delete keys linked to your GitHub account.gh label
Manage repository labels: create, edit, or delete them.gh ruleset
Work with GitHub's repository or organization rulesets.gh search
Search for repositories, issues, pull requests, and more.gh secret
Manage GitHub Secrets for repositories or environments.gh ssh-key
Manage SSH keys: list, add, or delete keys linked to your GitHub account.gh status
Display the current status of GitHub services.gh variable
Manage environment variables for GitHub Actions.
Need Help?
For any of these commands, use the --help
flag to see details about usage. For example:
gh repo --help
Examples
$ gh issue create
$ gh repo clone cli/cli
$ gh pr checkout 321
References
GitHub CLI Repository
https://github.com/cli/cliGitHub CLI Installation Instructions
https://cli.github.com