
GitHub CLI (`gh`) is GitHub's official command-line tool that brings pull requests, issues, and other GitHub concepts to your terminal.

## Features

- **Pull requests** - Create, view, checkout, and merge PRs
- **Issues** - List, view, create, and close issues
- **Repositories** - Clone, create, fork repos
- **Actions** - View and monitor workflow runs
- **Codespaces** - Manage cloud development environments
- **Gists** - Create and manage gists

## Setup

Install via package manager:

```bash
# Via mise (recommended)
mise install github-cli

# Ubuntu/Debian
# Download from GitHub releases

# Arch Linux
sudo pacman -S github-cli

# macOS
brew install gh
```

## Authentication

```bash
# Login to GitHub
gh auth login

# Verify status
gh auth status

# Logout
gh auth logout
```

## Repository Operations

```bash
# Clone repository
gh repo clone owner/repo

# Create new repository
gh repo create my-project --public

# Fork repository
gh repo fork owner/repo

# View repository
gh repo view owner/repo --web
```

## Pull Requests

```bash
# Create PR
git push origin feature-branch
gh pr create --title "Add feature" --body "Description"

# List PRs
gh pr list
gh pr list --state merged

# View PR
gh pr view 123
gh pr view 123 --web

# Checkout PR locally
gh pr checkout 123

# Check PR status
gh pr status

# Merge PR
gh pr merge 123 --squash
```

## Issues

```bash
# List issues
gh issue list
gh issue list --state closed

# Create issue
gh issue create --title "Bug report" --body "Description"

# View issue
gh issue view 123
gh issue view 123 --web

# Close issue
gh issue close 123

# Comment on issue
gh issue comment 123 --body "Thanks for reporting"
```

## Workflows

```bash
# List workflow runs
gh run list

# View workflow run
gh run view 123456789

# Watch workflow run
gh run watch 123456789

# Re-run failed jobs
gh run rerun 123456789
```

## Aliases

Create shortcuts for common commands:

```bash
# Create alias
gh alias set pv 'pr view'
gh alias set co 'pr checkout'

# Use alias
gh pv 123
gh co 123

# List aliases
gh alias list
```

## Configuration

Config file: `~/.config/gh/config.yml`

Example:

```yaml
git_protocol: ssh
editor: nvim
prompt: enabled
pager: delta
aliases:
    co: pr checkout
    pv: pr view
```

## See Also

<div class="embed-card">
  <a href="/git/" class="embed-card-link">
    <div class="embed-card-content">
      <div class="embed-card-title">Git Configuration</div>
      <div class="embed-card-description">Git configuration with aliases, delta for diffs, and work/personal separation</div>
      <div class="embed-card-meta">Feb 7, 2026</div>
    </div>
  </a>
</div>


<div class="embed-card">
  <a href="/lazygit/" class="embed-card-link">
    <div class="embed-card-content">
      <div class="embed-card-title">Lazygit</div>
      <div class="embed-card-description">Lazygit - a simple terminal UI for git commands</div>
      <div class="embed-card-meta">Feb 7, 2026</div>
    </div>
  </a>
</div>


<div class="embed-card embed-card-external">
  <a href="https://cli.github.com/" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-image">
      <img src="/assets/images/social-card.png" alt="" loading="lazy">
    </div>
    <div class="embed-card-content">
      <div class="embed-card-title">GitHub CLI</div>
      <div class="embed-card-description">Take GitHub to the command line</div>
      <div class="embed-card-meta">GitHub CLI &middot; cli.github.com</div>
    </div>
  </a>
</div>

