Как установить 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.
Что решает 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 atcli.github.com. Rungh --versionafter install.
Установка GitHub CLI
- 1macOS (Homebrew)
brew install gh. Verify withwhich ghandgh --version. - 2Linux
Debian/Ubuntu: add the official apt repo from
cli.github.com, thensudo apt install gh. Fedora:sudo dnf install gh. Tarballs on GitHub Releases for other distros. - 3Windows
winget install GitHub.cliorchoco install gh. Open a new terminal and rungh --version. - 4PATH
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 inCheck 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=1Same 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 @meList 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
- 1Branch and push
git checkout -b fix-docs, commit, thengit push -u origin fix-docs. - 2Open the PR
gh pr create --title "Fix docs" --body "Summary", or rungh pr createinteractively. - 3Options
--draft,--reviewer user1,user2,--base main. Inspect withgh pr list,gh pr view,gh pr checkout 42.
gh vs git / браузер
| Goal | gh | git / browser |
|---|---|---|
| Clone | gh repo clone owner/repo | git clone https://github.com/owner/repo.git |
| Issue | gh issue create | GitHub web → Issues → New |
| PR | gh pr create | Push branch → Compare & pull request |
| Session | gh auth status | Browser 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 как создать пространство.