此版本的 GitHub Enterprise 已停止服务 2021-09-23. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

GitHub CLI quickstart

Start using GitHub CLI to work with GitHub in the command line.

关于 GitHub CLI

GitHub CLI 是用于从计算机的命令行使用 GitHub Enterprise Server 的开源工具。 从命令行操作时,您可以使用 GitHub CLI 来节省时间并避免切换上下文。

入门指南

  1. Install GitHub CLI on macOS, Windows, or Linux.

  2. In the command line, authenticate to GitHub.

    gh auth login

    To authenticate to 您的 GitHub Enterprise Server 实例, use the --hostname flag.

    gh auth login --hostname hostname
  3. Start working with GitHub in the command line. For example, find an issue to work on with gh issue status or gh issue list --assignee @me. Create a pull request with gh pr create. Review a pull request with gh pr checkout, gh pr diff and gh pr review.

后续步骤

  • 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, see gh 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 run gh prd to quickly open a draft pull request. For more information, see gh 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."