Por Anónimo (no verificado) , 29 Abril 2026

Sinopsis

git config --global credential.helper <helper>
git credential fill
git credential approve
git credential reject

Descripción

El comando git credential es la interfaz de bajo nivel al sistema de credenciales de Git, usado por los asistentes (credential.helper) para almacenar, recuperar y olvidar credenciales para remotos HTTPS. Normalmente lo invocan los asistentes, no los usuarios directamente.

Las invocaciones interactivas comunes son git credential fill (obtener credenciales para una URL) y git credential reject (olvidar credenciales en caché). Configura un asistente con git config credential.helper.

En el uso diario, este comando se integra estrechamente con alias de shell, plugins de editor e integración continua. Los usuarios avanzados a menudo añaden alias que combinan los flags que siempre pasan. El formato de salida puede personalizarse vía configuración de Git. Cuando algo sale mal, ejecuta el comando con GIT_TRACE=1 para revelar las llamadas plumbing subyacentes.

Entender cómo este comando interactúa con el resto del modelo de datos de Git rinde dividendos. Cada comando opera sobre algún subconjunto de las piezas (objetos, index, refs, árbol de trabajo), y saber cuáles toca ayuda a predecir resultados y a recuperarse de errores.

Opciones comunes

Subcommand / ConfigDescription
credential.helperSet the credential helper to use.
credential.useHttpPathInclude URL path in the lookup key.
fillPlumbing: ask helpers for credentials.
approve / rejectTell helpers an attempt succeeded or failed.
credential.<url>.helperURL-specific helper.
credential.helper "cache --timeout=3600"Configurable in-memory cache.

Ejemplos

git config --global credential.helper osxkeychain
# macOS: store credentials in Keychain

git config --global credential.helper manager
# Cross-platform: Git Credential Manager

git config --global credential.helper "cache --timeout=3600"
# Cache for one hour in memory

# Per-host helper:
git config --global credential.https://github.com.helper "!gh auth git-credential"
# Use the GitHub CLI as the helper

Errores comunes

The store helper writes plain text to ~/.git-credentials — fine for throwaway VMs, dangerous on shared machines. Avoid passwords entirely; use personal access tokens or SSH keys for write access. After rotating a token, run git credential reject or clear the cache to force a refresh.

Comandos relacionados

git config, git push, git fetch, ssh-agent