Skip to content

credential-cache Git Command Guide

The git credential-cache command provides a credential helper that caches Git credentials in memory for a specified period. It’s useful for avoiding repeated credential prompts during a development session while remaining more secure than permanent storage.

Terminal window
git credential-cache [daemon [--options]] [<action>]
OptionDescription
—timeout Number of seconds to keep credentials cached (default 900 = 15 minutes)
—socket Path to socket file where daemon will listen
—helpDisplay help information
ActionDescription
(none)Contact daemon to get/store credentials
daemonStart the daemon (usually done automatically)
exitShut down credential cache daemon (kills all children)
ParameterDescription
Timeout in seconds for credential caching
Terminal window
git config --global credential.helper cache

Configures Git to use the cache helper.

Terminal window
git credential-cache --timeout 3600 daemon

Starts cache daemon with 1-hour timeout.

Terminal window
git credential-cache exit

Stops the credential cache daemon.

Terminal window
git config --global credential.helper 'cache --timeout 1800'

Sets cache timeout to 30 minutes globally.

To enable Git credential caching, use:

Terminal window
git config --global credential.helper cache

How can I set the credential cache timeout?

Section titled “How can I set the credential cache timeout?”

To set the credential cache timeout, run:

Terminal window
git config --global credential.helper 'cache --timeout 1800'

How do I stop the credential cache daemon?

Section titled “How do I stop the credential cache daemon?”

To stop the credential cache daemon, execute:

Terminal window
git credential-cache exit

What is the default timeout for credential cache?

Section titled “What is the default timeout for credential cache?”

The default timeout for credential cache is 15 minutes (900 seconds).

Credential cache stores credentials in memory temporarily, making them inaccessible after session ends or timeout expires.

Applications of the git credential-cache command

Section titled “Applications of the git credential-cache command”
  1. Reducing credential prompts during intensive Git workflows
  2. Supporting automated scripts that perform multiple Git operations
  3. Temporary credential storage for development sessions
  4. Balancing convenience and security in team development
  5. Enabling smooth experience in environments with frequent credential changes
  6. Supporting CI/CD pipelines that need short-term credential persistence