About GitHub CLI
GitHub CLI is an open source tool for using GitHub from your computer's command line. When you're working from the command line, you can use the GitHub CLI to save time and avoid switching context.
Getting started
- Install GitHub CLI on macOS, Windows, or Linux.
- In the command line, authenticate to GitHub. Replace
HOSTNAME
with the name of your GitHub Enterprise Server instance. For example,octo-inc.ghe.com
.
gh auth login --hostname HOSTNAME
- Start working with GitHub in the command line. For example, find an issue to work on with
gh issue status
orgh issue list --assignee @me
. Create a pull request withgh pr create
. Review a pull request withgh pr checkout
,gh pr diff
andgh pr review
.
Next steps
-
Tell GitHub CLI which text editor to use for commands that open a text editor. For example, enter
gh config set editor "code -w"
to set your preferred text editor to Visual Studio Code. For more information, seegh config set
. -
Define aliases for commands that you commonly run. For example, if you run
gh alias set prd "pr create --draft"
, you will then be able to rungh prd
to quickly open a draft pull request. For more information, seegh alias
. -
Create or add custom commands with GitHub CLI extensions. For more information, see "Using GitHub CLI extensions" and "Creating GitHub CLI extensions."
-
For more information about all of the commands that you can run with GitHub CLI, see "GitHub CLI reference."