Как установить GitHub CLI (gh): auth login, clone, issues и pull requests

Поставить gh, войти, клонировать репо, создать issue и PR из терминала.

GitHub CLI (gh) brings login, clone, issues, and pull requests into the terminal—handy beside git and scripts. This guide covers install on macOS/Linux/Windows, gh auth login, gh repo clone, gh issue create, and gh pr create for hereink readers who live in the shell.

The query is how to install GitHub CLI gh auth login clone repo create issue and pull request. You should finish with gh installed, GitHub.com authenticated, one repo cloned, and both an issue and a PR created from the CLI.

installbrew · apt · winget
authgh auth login
collabclone · issue · pr
install ghauth loginclone / issue / pr

Что решает gh

GitHub from the terminal

gh repo clone owner/repo, gh issue list, and gh pr create stay on the same screen as git. CI and local scripts can call the same commands.

Complements git

git handles commits and branches; gh handles GitHub metadata—PR text, reviewers, releases. Push with git; open PRs with gh.

Upstream: github.com/cli/cli, docs at cli.github.com. Run gh --version after install.

Установка GitHub CLI

  1. 1
    macOS (Homebrew)

    brew install gh. Verify with which gh and gh --version.

  2. 2
    Linux

    Debian/Ubuntu: add the official apt repo from cli.github.com, then sudo apt install gh. Fedora: sudo dnf install gh. Tarballs on GitHub Releases for other distros.

  3. 3
    Windows

    winget install GitHub.cli or choco install gh. Open a new terminal and run gh --version.

  4. 4
    PATH

    If the command is missing, ensure the install directory is on PATH. WSL and Windows may each need their own install.

gh auth login

Authenticate before first use:

gh auth login
# Typical GitHub.com flow:
# Account → GitHub.com
# Protocol → HTTPS or SSH (match your git remotes)
# Auth → Login with a web browser (recommended) or paste a token
# Browser completes OAuth → ✓ Logged in

Check with gh auth status. For GitHub Enterprise Server, pick the hostname when prompted—see official gh auth login docs.

gh repo clone

gh repo clone cli/cli
cd cli

gh repo clone owner/repo my-folder
gh repo clone owner/repo -- --depth=1

Same as git clone but short names work: gh repo clone owner/repo. Private repos require gh auth login and read access.

gh issue create

cd your-repo

gh issue create --title "Fix login timeout" --body "Steps to reproduce…"
gh issue create

gh issue create --title "Docs: gh guide" --label documentation --assignee @me

List and view: gh issue list, gh issue view 123. Confirm git remote -v points at the repo where you want the issue.

gh pr create

  1. 1
    Branch and push

    git checkout -b fix-docs, commit, then git push -u origin fix-docs.

  2. 2
    Open the PR

    gh pr create --title "Fix docs" --body "Summary", or run gh pr create interactively.

  3. 3
    Options

    --draft, --reviewer user1,user2, --base main. Inspect with gh pr list, gh pr view, gh pr checkout 42.

gh vs git / браузер

Goalghgit / browser
Clonegh repo clone owner/repogit clone https://github.com/owner/repo.git
Issuegh issue createGitHub web → Issues → New
PRgh pr createPush branch → Compare & pull request
Sessiongh auth statusBrowser profile menu
Подходит
Daily dev, open source, automation beside git, ripgrep, and HTTPie.
Не подходит
Local-only repos with no GitHub remote; rich review UI still often needs the browser.
gh auth login fails?

Try paste-token with a PAT that has required scopes (e.g. repo). Check proxy/firewall; org SSO may require authorizing the token. See cli.github.com troubleshooting.

Must I use gh clone?

No. Any git repo whose remote is on GitHub works with gh issue and gh pr. gh clone is just shorter.

gh vs GitHub Desktop?

Desktop is GUI-first; gh is terminal and script-first. Both can coexist with separate auth.

После PR — эскиз на одном листе

Architecture and review notes fit a shared canvas. See как создать пространство.

Начать