Saltar a contenido

GitHub CLI (gh)

Interfaz de línea de comandos oficial de GitHub. Permite gestionar PRs, issues, releases y más directamente desde la terminal.

Instalación

Agrega el repositorio oficial y instala:

(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
  && sudo mkdir -p -m 755 /etc/apt/keyrings \
  && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
  && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
  && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
  && sudo mkdir -p -m 755 /etc/apt/sources.list.d \
  && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
     | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
  && sudo apt update \
  && sudo apt install gh -y

Actualizar en el futuro:

sudo apt update && sudo apt install gh

Autenticación

gh auth login

Selecciona:

  • GitHub.com
  • SSH (recomendado si ya tienes llave configurada — ver Git → SSH)
  • Seguir las instrucciones en pantalla

Verificar sesión:

gh auth status

Comandos esenciales

# PRs
gh pr list
gh pr create
gh pr view <número>
gh pr merge <número>

# Issues
gh issue list
gh issue create
gh issue view <número>

# Repositorios
gh repo clone usuario/repo
gh repo view

# Releases
gh release list
gh release create v1.0.0