github-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub CLI

GitHub CLI

GitHub CLI is the fastest way to work with GitHub from a terminal.
GitHub CLI是从终端操作GitHub的最快方式。

Start Here

入门指南

  • Authenticate first:
    gh auth login
  • Check active context:
    gh auth status
  • Target another repo when needed:
    -R OWNER/REPO
  • Get command help anytime:
    gh <command> --help
  • 首先进行身份验证:
    gh auth login
  • 查看当前上下文:
    gh auth status
  • 需要时指定其他仓库:
    -R OWNER/REPO
  • 随时获取命令帮助:
    gh <command> --help

Common Workflow

常见工作流

bash
gh auth login
gh repo clone OWNER/REPO
gh issue list
gh pr create --fill
gh run watch
bash
gh auth login
gh repo clone OWNER/REPO
gh issue list
gh pr create --fill
gh run watch

References

参考文档

Core

核心命令

  • gh auth
    :
    references/auth.md
  • gh browse
    :
    references/browse.md
  • gh codespace
    :
    references/codespace.md
  • gh gist
    :
    references/gist.md
  • gh issue
    :
    references/issue.md
  • gh org
    :
    references/org.md
  • gh pr
    :
    references/pr.md
  • gh project
    :
    references/project.md
  • gh release
    :
    references/release.md
  • gh repo
    :
    references/repo.md
  • gh auth
    :
    references/auth.md
  • gh browse
    :
    references/browse.md
  • gh codespace
    :
    references/codespace.md
  • gh gist
    :
    references/gist.md
  • gh issue
    :
    references/issue.md
  • gh org
    :
    references/org.md
  • gh pr
    :
    references/pr.md
  • gh project
    :
    references/project.md
  • gh release
    :
    references/release.md
  • gh repo
    :
    references/repo.md

Actions

Actions相关命令

  • gh cache
    :
    references/cache.md
  • gh run
    :
    references/run.md
  • gh workflow
    :
    references/workflow.md
  • gh cache
    :
    references/cache.md
  • gh run
    :
    references/run.md
  • gh workflow
    :
    references/workflow.md

Additional

其他命令

  • gh agent-task
    :
    references/agent-task.md
  • gh alias
    :
    references/alias.md
  • gh api
    :
    references/api.md
  • gh attestation
    :
    references/attestation.md
  • gh completion
    :
    references/completion.md
  • gh config
    :
    references/config.md
  • gh copilot
    :
    references/copilot.md
  • gh extension
    :
    references/extension.md
  • gh gpg-key
    :
    references/gpg-key.md
  • gh label
    :
    references/label.md
  • gh licenses
    :
    references/licenses.md
  • gh preview
    :
    references/preview.md
  • gh ruleset
    :
    references/ruleset.md
  • gh search
    :
    references/search.md
  • gh secret
    :
    references/secret.md
  • gh ssh-key
    :
    references/ssh-key.md
  • gh status
    :
    references/status.md
  • gh variable
    :
    references/variable.md
  • gh agent-task
    :
    references/agent-task.md
  • gh alias
    :
    references/alias.md
  • gh api
    :
    references/api.md
  • gh attestation
    :
    references/attestation.md
  • gh completion
    :
    references/completion.md
  • gh config
    :
    references/config.md
  • gh copilot
    :
    references/copilot.md
  • gh extension
    :
    references/extension.md
  • gh gpg-key
    :
    references/gpg-key.md
  • gh label
    :
    references/label.md
  • gh licenses
    :
    references/licenses.md
  • gh preview
    :
    references/preview.md
  • gh ruleset
    :
    references/ruleset.md
  • gh search
    :
    references/search.md
  • gh secret
    :
    references/secret.md
  • gh ssh-key
    :
    references/ssh-key.md
  • gh status
    :
    references/status.md
  • gh variable
    :
    references/variable.md

Notes

注意事项

  • Prefer
    --json
    ,
    --jq
    , or
    --template
    for scripts
  • gh api
    is the fallback for anything not covered by a dedicated command
  • For GitHub Enterprise, use
    --hostname
    or set
    GH_HOST
  • 编写脚本时优先使用
    --json
    --jq
    --template
    参数
  • 对于专用命令未覆盖的操作,可使用
    gh api
    作为备选方案
  • 针对GitHub Enterprise,使用
    --hostname
    参数或设置
    GH_HOST
    环境变量