GitHub CLI manual To set your preferred editor, use gh config set editor <editor> Read more about gh config and environment variables Declare your aliases for often-used commands with gh alias set GitHub Enterprise GitHub CLI supports GitHub Enterprise Server 2 20 and above To authenticate with a GitHub instance, run:
GitHub CLI | Take GitHub to the command line Take GitHub to the command line gh Work seamlessly with GitHub from the command line Core commands gh auth gh browse gh codespace gh gist gh issue gh org gh pr gh project gh release gh repo GitHub Actions commands gh cache gh run gh workflow Additional commands gh agent-task gh alias gh api gh attestation gh completion gh config gh copilot gh extension gh gpg-key gh label gh licenses gh
Examples | GitHub CLI GitHub CLI usage examples Checking out a pull request locally Using pull request number You can check out any pull request, including from forks, in a repository using its pull request number
GitHub CLI | Take GitHub to the command line Take GitHub to the command line gh run List, view, and watch recent workflow runs from GitHub Actions Available commands gh run cancel gh run delete gh run download gh run list gh run rerun gh run view gh run watch Options -R, --repo <[HOST ]OWNER REPO> Select another repository using the [HOST ]OWNER REPO format See also gh
GitHub CLI | Take GitHub to the command line Take GitHub to the command line --cache duration Cache the response, e g "3600s", "60m", "1h" -F, --field key=value Add a typed parameter in key=value format (use "@<path>" or "@-" to read value from file or stdin) -H, --header key:value Add a HTTP request header in key:value format --hostname string The GitHub hostname for the request (default "github com") -i, --include Include HTTP
GitHub CLI | Take GitHub to the command line Take GitHub to the command line Transition from the terminal to the web browser to view and interact with: Issues Pull requests Repository content Repository home page Repository settings Options -a, --actions Open repository actions --blame Open blame view for a file -b, --branch <string> Select another branch by passing in the branch name -c, --commit <string> Select another commit by
GitHub CLI | Take GitHub to the command line Clone a GitHub repository locally Pass additional git clone flags by listing them after -- If the OWNER portion of the OWNER REPO repository argument is omitted, it defaults to the name of the authenticating user When a protocol scheme is not provided in the repository argument, the git_protocol will be chosen from your configuration, which can be checked via gh config get git_protocol If
GitHub CLI | Take GitHub to the command line See gh help environment for more info To use gh in GitHub Actions, add GH_TOKEN: ${{ github token }} to env The git protocol to use for git operations on this host can be set with --git-protocol, or during the interactive prompting Although login is for a single account on a host, setting the git protocol will take effect for all users on
GitHub CLI | Take GitHub to the command line Take GitHub to the command line gh repo Work with GitHub repositories General commands gh repo create gh repo list Targeted commands gh repo archive gh repo autolink gh repo clone gh repo delete gh repo deploy-key gh repo edit gh repo fork gh repo gitignore gh repo license gh repo rename gh repo set-default gh repo sync gh repo unarchive gh repo view Examples $ gh repo create $ gh repo clone