GitHub CLI (gh) installieren: auth login, clone, Issues und PRs im Terminal

gh installieren, anmelden, Repository klonen und Issues sowie Pull Requests im Terminal erstellen.

Copying PATs from the browser, pasting clone URLs, then switching tabs to file an issue or open a PR adds friction. GitHub CLI (gh) keeps login, clone, issues, and pull requests in the terminal. Install and auth steps follow cli.github.com.

Searchers looking for install GitHub CLI gh auth login clone create issue PR terminal want a checkable path: install gh, run gh auth login, gh repo clone, then create an issue and a PR from the shell. Verify flags with gh <command> -h on your machine.

Install ghgh auth loginClone · issue · PR

Who gh is for

01

Daily issue and PR authors

After commits on a feature branch, run gh pr create without leaving the terminal.

02

Developers across many org repos

gh repo clone org/repo uses your logged-in identity for private repositories.

03

Script and CI debugging

Run gh auth status before workflow or release commands to confirm scopes.

Install GitHub CLI

  1. 1

    macOS: Homebrew

    brew install gh, then gh --version.

  2. 2

    Debian / Ubuntu

    Add the official apt repository per GitHub docs, then sudo apt install gh, or use your distro package. Confirm with gh --version.

  3. 3

    Windows

    winget install GitHub.cli or scoop install gh (verify package names in the store).

  4. 4

    Other Linux

    Fedora: sudo dnf install gh. Arch: sudo pacman -S github-cli. Otherwise use GitHub Releases binaries.

gh auth login

  1. 1

    Start interactive login

    Run gh auth login. Choose GitHub.com (or your Enterprise hostname).

  2. 2

    Protocol and credentials

    Pick HTTPS or SSH per team policy. HTTPS often uses browser OAuth or a one-time token — follow prompts; never commit tokens.

  3. 3

    Verify

    gh auth status should show the account and token scopes. If git push fails, check remote URL and SSH keys.

  4. 4

    Multiple accounts (optional)

    Use gh auth switch or host entries documented for your version; see gh auth login -h.

gh auth login
gh auth status

Clone with gh repo clone

gh repo clone github/github-cli
cd github-cli
git remote -v

Works for private repos you can read. Plain git clone remains fine once auth is configured.

Create issues and pull requests

CommandActionTypical use
gh issue createNew issueBug reports, requests
gh issue listList issuesTriage
gh pr createOpen pull requestAfter pushing a branch
gh pr statusPR state for current branchCI feedback
gh pr checkout 123Check out a PR locallyReview
  1. 1

    Create an issue

    In the repo root: gh issue create --title "Fix login timeout" --body "Steps to reproduce…". Without flags, gh may open an interactive editor.

  2. 2

    Push a branch

    git checkout -b fix/login, commit, git push -u origin fix/login.

  3. 3

    Open a PR

    gh pr create --title "Fix login timeout" --body "Closes #42". Use gh pr create --web if your team relies on a PR template in the browser.

  4. 4

    Inspect

    gh pr view --web opens the PR; gh pr checks shows CI when enabled.

gh talks to GitHub’s API; it does not replace Git. Use git for commits and merges; use gh for hosted objects like issues and pull requests.

401 after login
Try gh auth refresh or log in again; confirm the correct hostname.
Cannot open a PR
Check write access or fork workflow; forks may need --repo owner/upstream.
With lazygit or an IDE
Use lazygit for staging and commits, gh for issues and PRs — see our lazygit guide.

To sync on PR text or a flow diagram, open a browser room from the wbroom homepage — create and join a room.

Questions worth checking

How do gh and git relate?

git is version control; gh is GitHub’s official CLI for API and GitHub-specific tasks. Use both.

Must I use gh repo clone?

No. After auth, git clone is fine; gh repo clone is a convenient shorthand.

Non-interactive PR creation?

Pass --title, --body, --base, and --head. In scripts, check gh auth status first.

How do I log out?

gh auth logout. On shared machines, log out before leaving.

Meeting starten