uTools-Manuals/docs/git/git credential-cache.html
2019-04-08 23:22:26 +08:00

3 lines
3.3 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="c-markdown doc-markdown"><div class="doc-postil"><div class="c-markdown"><h2>名称</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>git-credential-cache  -  Helper 临时将密码存储在内存中</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>概要</h2></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">git config credential.helper 'cache [options]'</pre></div></div><div class="doc-postil"><div class="c-markdown"><h2>Description</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>该命令将内存中的凭证缓存供将来的 Git 程序使用。存储的凭证永远不会触及磁盘,并在可配置的超时后被遗忘。缓存可通过 Unix 域套接字进行访问,通过文件系统权限仅限于当前用户。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>你可能不想直接调用这个命令;它意味着被 Git 的其他部分用作凭证助手。请参阅 gitcredentials [7]或<code>EXAMPLES</code>以下。</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>选项</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>--timeout &lt;seconds&gt;</p></div></div><div class="doc-postil"><div class="c-markdown"><p>缓存凭据的秒数默认值900</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--socket &lt;path&gt;</p></div></div><div class="doc-postil"><div class="c-markdown"><p>使用<code>&lt;path&gt;</code>联系运行中的高速缓存守护进程(或启动一个新的高速缓存守护进程,如果未启动)。默认为<code>$XDG_CACHE_HOME/git/credential/socket</code>除非<code>~/.git-credential-cache/</code>在存在的情况下<code>~/.git-credential-cache/socket</code>使用。如果您的主目录位于网络安装的文件系统上,则可能需要将其更改为本地文件系统。您必须指定绝对路径。</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>控制daemon守护进程</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>如果您希望守护进程提前退出,并在所有缓存的凭据超时前忘记,则可以执行以下<code>exit</code>操作:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">git credential-cache exit</pre></div></div><div class="doc-postil"><div class="c-markdown"><h2>示例</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>这个 helper 的重点是减少你输入用户名或密码的次数。例如:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">$ 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><div class="doc-postil"><div class="c-markdown"><p>您可以通过 credential.helper 配置变量提供选项此示例将缓存时间降低到5分钟</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">$ git config credential.helper 'cache --timeout=300'</pre></div></div></div>