Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsApr 11, 2026·2 min de lecture

GitHub CLI (gh) — GitHub Official Command Line Tool

GitHub CLI brings GitHub to your terminal. Create PRs, manage issues, review code, run Actions, browse releases — without leaving the command line. Written in Go and the official cross-platform tool from GitHub.

Introduction

GitHub CLI (binary gh) is the official command line tool for GitHub. Written in Go by the GitHub team, it brings issues, pull requests, Actions, releases, gists, and the REST/GraphQL API directly to your terminal. Cross-platform and works with GitHub.com + GitHub Enterprise.

What gh Does

  • Repos — create, clone, fork, view, archive
  • Pull requests — create, checkout, review, merge
  • Issues — create, close, comment, assign, label
  • Actions — list runs, view logs, rerun, watch
  • Releases — create, upload assets, generate notes
  • Gists — create, list, view
  • API passthroughgh api for any REST/GraphQL endpoint
  • Extensions — install community extensions (gh extension install)
  • Codespaces — create, list, ssh into Codespaces
  • Copilot integrationgh copilot explain / gh copilot suggest

Architecture

Go CLI that hits the GitHub REST + GraphQL APIs. Auth stored via OAuth device flow in keyring. Commands are composable (--json fields | jq). Extensions add new subcommands by installing binaries or scripts into ~/.local/share/gh/extensions.

Self-Hosting

CLI tool. Authenticates to github.com or your GHES instance.

Key Features

  • Full PR workflow
  • Issue management
  • Actions monitoring and rerun
  • Release management
  • Gist creation
  • GraphQL API passthrough
  • Extension system
  • Copilot CLI integration
  • Cross-platform
  • JSON output for scripting

Comparison

Tool Platform Auth Extensions
gh GitHub OAuth Yes
glab GitLab Token Limited
hub GitHub (legacy) Token No
tea Gitea Token No
bitbucket-cli Bitbucket Token No

FAQ

Q: What's the difference between hub and gh? A: hub is the older third-party CLI; gh is the official GitHub tool (2020+) with more features and a better experience. hub no longer gets new features.

Q: Can it be scripted? A: Yes. gh pr list --json title,url --jq .[].url outputs JSON; paired with jq, it's easy to script CI tasks.

Q: Can I call the API directly? A: Yes. gh api /repos/owner/repo/issues hits any REST endpoint; gh api graphql -f query=... runs GraphQL.

Sources & Credits

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires