summaryrefslogtreecommitdiff
path: root/devdocs/git/git-credential-cache.html
blob: 3c9312ecb59e10febab4afc912054f30323fcff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<h1>git-credential-cache</h1>  <h2 id="_name">Name</h2> <div class="sectionbody">  <p>git-credential-cache - Helper to temporarily store passwords in memory</p>  </div>   <h2 id="_synopsis">Synopsis</h2> <div class="sectionbody"> <div class="listingblock"> <div class="content"> <pre data-language="shell">git config credential.helper 'cache [&lt;options&gt;]'</pre> </div> </div> </div>   <h2 id="_description">Description</h2> <div class="sectionbody">  <p>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.</p>   <p>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 <a href="gitcredentials">gitcredentials[7]</a> or <code>EXAMPLES</code> below.</p>  </div>   <h2 id="_options">Options</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-credential-cache.txt---timeoutltsecondsgt"> --timeout &lt;seconds&gt; </dt> <dd> <p>Number of seconds to cache credentials (default: 900).</p> </dd> <dt class="hdlist1" id="Documentation/git-credential-cache.txt---socketltpathgt"> --socket &lt;path&gt; </dt> <dd> <p>Use <code>&lt;path&gt;</code> to contact a running cache daemon (or start a new cache daemon if one is not started). Defaults to <code>$XDG_CACHE_HOME/git/credential/socket</code> unless <code>~/.git-credential-cache/</code> exists in which case <code>~/.git-credential-cache/socket</code> 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.</p> </dd> </dl> </div> </div>   <h2 id="_controlling_the_daemon">Controlling the daemon</h2> <div class="sectionbody">  <p>If you would like the daemon to exit early, forgetting all cached credentials before their timeout, you can issue an <code>exit</code> action:</p>  <div class="listingblock"> <div class="content"> <pre data-language="shell">git credential-cache exit</pre> </div> </div> </div>   <h2 id="_examples">Examples</h2> <div class="sectionbody">  <p>The point of this helper is to reduce the number of times you must type your username or password. For example:</p>  <div class="listingblock"> <div class="content"> <pre data-language="shell-session">$ 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]</pre> </div> </div>  <p>You can provide options via the credential.helper configuration variable (this example increases the cache time to 1 hour):</p>  <div class="listingblock"> <div class="content"> <pre data-language="shell-session">$ git config credential.helper 'cache --timeout=3600'</pre> </div> </div> </div><div class="_attribution">
  <p class="_attribution-p">
    &copy; 2012&ndash;2024 Scott Chacon and others<br>Licensed under the MIT License.<br>
    <a href="https://git-scm.com/docs/git-credential-cache" class="_attribution-link">https://git-scm.com/docs/git-credential-cache</a>
  </p>
</div>