<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">

<sect2 lang="en" id="git-credential-cache(1)">
    <title>git-credential-cache(1)</title>
    <date>2024-07-02</date>
<revhistory><revision><date>2024-07-02</date></revision></revhistory>
<indexterm>
<primary>git-credential-cache(1)</primary>
</indexterm>
<simplesect id="git-credential-cache(1)__name">
<title>NAME</title>
<simpara>git-credential-cache - Helper to temporarily store passwords in memory</simpara>
</simplesect>
<simplesect id="git-credential-cache(1)__synopsis">
<title>SYNOPSIS</title>
<screen>git config credential.helper 'cache [&lt;options&gt;]'</screen>
</simplesect>
<simplesect id="git-credential-cache(1)__description">
<title>DESCRIPTION</title>
<simpara>This command caches credentials for use by future Git programs.
The stored credentials are kept in memory of the cache-daemon
process (instead of being written to a file) and are forgotten after a
configurable timeout. Credentials are forgotten sooner if the
cache-daemon dies, for example if the system restarts. The cache
is accessible over a Unix domain socket, restricted to the current
user by filesystem permissions.</simpara>
<simpara>You probably don't want to invoke this command directly; it is meant to
be used as a credential helper by other parts of Git. See
<xref linkend="gitcredentials(7)" /> or <emphasis>EXAMPLES</emphasis> below.</simpara>
</simplesect>
<simplesect id="git-credential-cache(1)__options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
--timeout &lt;seconds&gt;
</term>
<listitem>
<simpara>
        Number of seconds to cache credentials (default: 900).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--socket &lt;path&gt;
</term>
<listitem>
<simpara>
        Use <emphasis>&lt;path&gt;</emphasis> to contact a running cache daemon (or start a new
        cache daemon if one is not started).
        Defaults to <emphasis>$XDG_CACHE_HOME/git/credential/socket</emphasis> unless
        <emphasis>~/.git-credential-cache/</emphasis> exists in which case
        <emphasis>~/.git-credential-cache/socket</emphasis> is used instead.
        If your home directory is on a network-mounted filesystem, you
        may need to change this to a local filesystem. You must specify
        an absolute path.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="git-credential-cache(1)__controlling_the_daemon">
<title>CONTROLLING THE DAEMON</title>
<simpara>If you would like the daemon to exit early, forgetting all cached
credentials before their timeout, you can issue an <emphasis>exit</emphasis> action:</simpara>
<screen>git credential-cache exit</screen>
</simplesect>
<simplesect id="git-credential-cache(1)__examples">
<title>EXAMPLES</title>
<simpara>The point of this helper is to reduce the number of times you must type
your username or password. For example:</simpara>
<screen>$ git config credential.helper cache
$ git push http://example.com/repo.git
Username: &lt;type your username&gt;
Password: &lt;type your password&gt;

[work for 5 more minutes]
$ git push http://example.com/repo.git
[your credentials are used automatically]</screen>
<simpara>You can provide options via the credential.helper configuration
variable (this example increases the cache time to 1 hour):</simpara>
<screen>$ git config credential.helper 'cache --timeout=3600'</screen>
</simplesect>
<simplesect id="git-credential-cache(1)__git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
</simplesect>
</sect2>
