← 返回命令列表

Linux command

git-credential-cache 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Cache credentials for 15 minutes

git config credential.helper cache

Cache for specific duration

git config credential.helper 'cache --timeout=[3600]'

Cache with custom socket path

git config credential.helper 'cache --socket=[~/.git-credential-cache/socket]'

Exit

git credential-cache exit

说明

git credential-cache is a credential helper that temporarily stores authentication credentials in memory via a daemon process. It provides a balance between security and convenience by avoiding repeated password prompts without permanently storing credentials on disk. When configured as a credential helper, it automatically captures credentials during the first authentication and reuses them for subsequent operations within the timeout period. The default timeout is 15 minutes (900 seconds), configurable with the --timeout option. The daemon stores credentials in a Unix domain socket, accessible only to the current user. Credentials automatically expire after the timeout and are never written to disk, making this more secure than git-credential-store. The cache can be manually cleared with git credential-cache exit.

参数

--timeout _seconds_
Number of seconds to cache credentials (default: 900, i.e. 15 minutes).
--socket _path_
Path to the Unix socket used to communicate with the cache daemon (default: ~/.cache/git/credential/socket).
exit
Cause the cache daemon to exit, discarding all cached credentials.
get, store, erase
Standard credential helper actions (normally invoked by git itself, not manually).

FAQ

What is the git-credential-cache command used for?

git credential-cache is a credential helper that temporarily stores authentication credentials in memory via a daemon process. It provides a balance between security and convenience by avoiding repeated password prompts without permanently storing credentials on disk. When configured as a credential helper, it automatically captures credentials during the first authentication and reuses them for subsequent operations within the timeout period. The default timeout is 15 minutes (900 seconds), configurable with the --timeout option. The daemon stores credentials in a Unix domain socket, accessible only to the current user. Credentials automatically expire after the timeout and are never written to disk, making this more secure than git-credential-store. The cache can be manually cleared with git credential-cache exit.

How do I run a basic git-credential-cache example?

Run `git config credential.helper cache` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --timeout _seconds_ do in git-credential-cache?

Number of seconds to cache credentials (default: 900, i.e. 15 minutes).