git-credential-cache
Cache Git credentials in memory
TLDR
Store Git credentials for a specific amount of time
SYNOPSIS
git-credential-cache [--timeout=<seconds>] [--socket=<path>] {get|store|erase}
git-credential-cache--daemon [--timeout=<seconds>] [--socket=<path>] [--idle=<seconds>]
PARAMETERS
--timeout=<seconds>
Duration (seconds) to cache credentials. Default: 900 (15 min).
--socket=<path>
Unix socket file path for daemon communication. Defaults to runtime dir.
--idle=<seconds>
Daemon idle timeout before exit (daemon mode only). Defaults to --timeout.
DESCRIPTION
git-credential-cache is a Git credential helper that securely caches approved credentials in memory for a configurable timeout period, avoiding repeated password prompts during Git operations like clone, fetch, or push.
It operates via a background daemon process using a Unix domain socket for communication. When configured (e.g., git config credential.helper 'cache --timeout=3600'), Git invokes git-credential-cache get to request credentials. The daemon stores them temporarily after user approval.
Key operations:
• get: Retrieves cached credential or prompts and caches.
• store: Caches a provided credential.
• erase: Removes a credential from cache.
The daemon mode (git-credential-cache--daemon) runs persistently until idle. Credentials are held only in RAM, making it safer than disk-based helpers like store, as they vanish on reboot, process kill, or timeout. Ideal for workstations but not shared or long-running servers.
Default timeout is 900 seconds (15 minutes); socket path auto-detects via XDG_RUNTIME_DIR or /tmp. Supports the standard credential protocol over stdin/stdout.
CAVEATS
Unix domain sockets only (no Windows native). Credentials lost on reboot/daemon kill. Visible daemon process; avoid on multi-user systems.
CONFIGURATION
Enable globally: git config --global credential.helper 'cache --timeout=3600'
Per-repo: Omit --global.
PROTOCOL INPUT
Reads from stdin: protocol=https
host=example.com
path=/repo.git (ends with blank line).
HISTORY
Introduced in Git 1.6.6 (Oct 2008) to support credential API. Added idle timeout in Git 2.3 (2014); improved socket handling in later versions for better security and portability.
SEE ALSO
git-credential-store(1), git-credential-osxkeychain(1), git-credential-manager(1), gitcredentials(7)


