User Tools

Site Tools


github_cli

GitHub CLI

Return to GitHub CLI Installation, GitHub, List of CLIs, Command-Line Interfaces, Git, GitHub, GitHub Actions, GitHub Codespaces Cloud IDE

gh is GitHub on the command line. It brings GitHub pull requests, GitHub issues, and other GitHub concepts to the GitHub terminal next to where you are already working with git and your code.

Usage:

gh

Work seamlessly with GitHub from the command line.

USAGE

 gh   [flags]

CORE COMMANDS

 browse:     Open the repository in the browser
 gist:       Manage gists
 issue:      Manage issues
 pr:         Manage pull requests
 release:    Manage GitHub releases
 repo:       Create, clone, fork, and view repositories

ACTIONS COMMANDS

 actions:    Learn about working with GitHub actions
 run:        View details about workflow runs
 workflow:   View details about GitHub Actions workflows

ADDITIONAL COMMANDS

 alias:      Create command shortcuts
 api:        Make an authenticated GitHub API request
 auth:       Login, logout, and refresh your authentication
 completion: Generate shell completion scripts
 config:     Manage configuration for gh
 extension:  Manage gh extensions
 help:       Help about any command
 secret:     Manage GitHub secrets
 ssh-key:    Manage SSH keys

FLAGS

 --help      Show help for command
 --version   Show gh version

EXAMPLES

 $ gh issue create
 $ gh repo clone cli/cli
 $ gh pr checkout 321

ENVIRONMENT VARIABLES

 See 'gh help environment' for the list of supported environment variables.

LEARN MORE

 Use 'gh   --help' for more information about a command.
 Read the manual at https://cli.github.com/manual

FEEDBACK

 Open an issue using 'gh issue create -R github.com/cli/cli'
 
 
 ----

GitHub CLI gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code.

Installation You can find installation instructions on our README.

Authentication Run gh auth login to authenticate with your GitHub account. gh will respect tokens set using GITHUB_TOKEN.

GitHub Enterprise Server GitHub CLI supports GHES 2.20 and above. To authenticate with a GitHub Enterprise instance, run:

gh auth login –hostname <hostname> You will be prompted to either authenticate using your browser, or to paste a token.

Setting an editor To set your preferred editor, you can use gh config set editor <editor>. Read more about gh config.

Additionally if the above is not set, for macOS and Linux, gh will respect editor environment variables based on your OS and shell setup.

On macOS and Linux, the default editor is Nano. On Windows, the default editor is Notepad.

Setting your git protocol To set your preferred git protocol, you can use gh config set git_protocol { ssh | https }. Read more about gh config.

Disable interactivity To disable interactive prompts, you can use gh config set prompt disabled. Read more about gh config.

Extending the CLI There are several ways you can make gh your own.

Create shorthands using gh alias set Make custom API queries using gh api Use environment variables

https://cli.github.com/manual/


GitHub CLI gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code.

screenshot of gh pr status

GitHub CLI is available for repositories hosted on GitHub.com and GitHub Enterprise Server 2.20+, and to install on macOS, Windows, and Linux.

Documentation See the manual for setup and usage instructions.

Contributing If anything feels off, or if you feel that some functionality is missing, please check out the contributing page. There you will find instructions for sharing your feedback, building the tool locally, and submitting pull requests to the project.

Installation

  • macOS

gh is available via Homebrew, MacPorts, Conda, and as a downloadable binary from the releases page.

Homebrew

Install: Upgrade:

brew install gh

brew upgrade gh

MacPorts

Install: Upgrade:

sudo port install gh (see port install

sudo port selfupdate && sudo port upgrade gh

Conda

Install: Upgrade:

conda install gh –channel conda-forge

conda update gh –channel conda-forge

Additional Conda installation options available on the gh-feedstock page.

Linux & BSD

gh is available via Homebrew, Conda, and as downloadable binaries from the releases page.

For instructions on specific distributions and package managers, see Linux & BSD installation.

Windows

gh is available via WinGet, scoop, Chocolatey, Conda, and as downloadable MSI.

WinGet

Install: Upgrade:

winget install gh

winget upgrade gh

scoop

Install: Upgrade:

scoop install gh

scoop update gh

Chocolatey

Install: Upgrade:

choco install gh

choco upgrade gh

Signed MSI

MSI installers are available for download on the releases page.

GitHub Actions

Other platforms

Download packaged binaries from the releases page: https://github.com/cli/cli/releases/tag/v2.0.0

Comparison with hub

For many years, hub was the unofficial GitHub CLI tool. gh is a new project that helps us explore what an official GitHub CLI tool can look like with a fundamentally different design. While both tools bring GitHub to the terminal, hub behaves as a proxy to git, and gh is a standalone tool. Check out our more detailed explanation to learn more.

https://github.com/cli/cli#installation


gh

Work seamlessly with GitHub from the command line.

USAGE gh <command> <subcommand> [flags]

CORE COMMANDS

  • browse: Open the repository in the browser
  • gist: Manage gists
  • issue: Manage issues
  • pr: Manage pull requests
  • release: Manage GitHub releases
  • repo: Create, clone, fork, and view repositories

ACTIONS COMMANDS

  • actions: Learn about working with GitHub actions
  • run: View details about workflow runs
  • workflow: View details about GitHub Actions workflows

ADDITIONAL COMMANDS

  • alias: Create command shortcuts
  • api: Make an authenticated GitHub API request
  • auth: Login, logout, and refresh your authentication
  • completion: Generate shell completion scripts
  • config: Manage configuration for gh
  • extension: Manage gh extensions
  • help: Help about any command
  • secret: Manage GitHub secrets
  • ssh-key: Manage SSH keys

FLAGS

EXAMPLES

 $ [[gh issue create]]
 $ [[gh repo clone]] cli/cli
 $ [[gh pr checkout]] 321

ENVIRONMENT VARIABLES

 See '[[gh help environment]]' for the list of supported [[gh environment variables]].

LEARN MORE

 Use 'gh   --help' for more information about a command.
 Read the manual at https://cli.github.com/manual

FEEDBACK

 Open an issue using 'gh issue create -R github.com/cli/cli'

PS C:\Users\USER> gh actions

Welcome to GitHub Actions on the command line.

GitHub CLI integrates with Actions to help you manage runs and workflows.

Interacting with workflow runs

To see more help, run 'gh help run <subcommand>'

Interacting with GitHub workflow files

To see more help, run 'gh help workflow <subcommand>'

For more in depth help including examples, see online documentation at:

https://docs.github.com/en/actions/guides/managing-github-actions-with-github-cli

PS C:\Users\USER> gh workflow list

Welcome to GitHub CLI!

To authenticate, please run `gh auth login`.

PS C:\Users\USER> gh auth login

  • ? What account do you want to log into? GitHub.com
  • ? What is your preferred protocol for Git operations? HTTPS
  • ? Authenticate Git with your GitHub credentials? Yes
  • ? How would you like to authenticate GitHub CLI? Login with a web browser
  • ! First copy your one-time code: XXXX-XXXX
  • - Press Enter to open github.com in your browser…
  • ✓ Authentication complete. Press Enter to continue…
  • - gh config set -h github.com git_protocol https
  • ✓ Configured git protocol
  • ✓ Logged in as USER

Fair Use Sources

GitHub: GitOps, GitHub Copilot (Learn AI-Assisted Python Programming), GitHub for Major Software and Languages, GitHub Fundamentals, GitHub Inventor: GitHub and Git, GitHub Stars: GitHub Organization Ranking, GitHub Stars Ranking, GitHub Big Tech, Cloud Monk's favorite GitHub repos, gh plugin, git help, Version control, GitHub topics, Git topics, Git, GitHub repos, GitHub bibliography, Manning Git-GitHub Series, GitHub Actions, GitHub CodeSpaces, GitHub CLI, GitHub Free, GitHub Pro, GitHub Team, GitHub Enterprise, GitHub security (GitHub MFA - GitHub Passkeys) - GitHub Secrets - Authenticating with GitHub from Git (gh auth login), GLFS, GitHub Packages, GitHub alternative source code repos (GitHub - GitLab - AWS CodeCommit - Google Cloud Source Repositories - Bitbucket), Install Git, Git for Windows (choco search github, brew search github), Git for Linux, Git for macOS, GitHub glossary, Git glossary. (navbar_github - see also navbar_git, navbar_gitops, navbar_iac)


Cloud Monk is Retired (for now). Buddha with you. © 2005 - 2024 Losang Jinpa or Fair Use. Disclaimers

SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.


github_cli.txt · Last modified: 2022/10/09 17:22 by 127.0.0.1