Getting Started with GitHub CLI (gh) / Chapter 1 — Getting Started with gh (lessons 1–4) / Lesson 1
What gh Is — GitHub from Your Terminal
Time needed: about 7 min (estimate)
Reading settings
These settings are remembered on this device only.
You can try the opening of this lesson without an account.
Bringing browser work into the terminal
GitHub CLI (the command is gh) is GitHub's official command-line tool. Opening pull requests, finding issues, checking CI results, publishing releases: the work you usually do in the browser, you can do right from your terminal. The first line of its help describes it like this. Commands follow the shape gh <command> <subcommand> [flags], naming the thing first and then the action, as in gh pr list.
Terminal
How it differs from git
The names look alike, but the jobs are clearly split. git works on your local repository: it makes commits and pushes to and pulls from a remote. Pull requests, issues, and Actions, on the other hand, are not part of git; they belong to the GitHub service. gh handles them by calling the GitHub API. So gh doesn't replace git; you use the two side by side.
Terminal
What gh can do
The help groups commands into CORE COMMANDS (repo, issue, pr, release, and more), GITHUB ACTIONS COMMANDS (run, workflow, cache), and ADDITIONAL COMMANDS (api, search, alias, extension, and more). Here are the main ones this course uses and the lessons where they appear. -R cli/cli means "work on the cli/cli repository"; Lesson 4 covers it in detail.
Terminal
Getting results as JSON
Many gh commands return JSON instead of a table when you pass field names to --json. Below is real output from gh repo view cli/cli --json for cli/cli, the public repository where gh itself lives, trimmed to a few fields and embedded in the code. Let's read it with Python in your browser and pull out the key points.
Tab indents. To leave the editor, press Esc, then Tab.
Create a free account to keep reading
With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.
Report a problem with this lesson
Log in to send a report.