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

4 lines
5.1 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-store  - 帮助者将证书存储在磁盘上</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 'store [options]'</pre></div></div><div class="doc-postil"><div class="c-markdown"><h2>描述</h2></div></div><div class="doc-postil"><div class="c-markdown"><div class="table-wrapper"><table><thead><tr class="firstRow"><th style="text-align: left;"><div class="table-header"><p>注意</p></div></th><th style="text-align: left;"><div class="table-header"><p>使用这个帮助程序会将你的密码存储在磁盘上,只受文件系统权限保护。如果这不是一个可以接受的安全权衡,请尝试使用 git-credential-cache1或者找到一个与操作系统提供的安全存储集成的帮助器。</p></div></th></tr></thead><tbody></tbody></table></div></div></div><div class="doc-postil"><div class="c-markdown"><p>该命令将无限期地将证书存储在磁盘上供将来的 Git 程序使用。</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>--file=&lt;path&gt;</p></div></div><div class="doc-postil"><div class="c-markdown"><p>使用<code>&lt;path&gt;</code>查找和存储凭据。该文件将设置文件系统权限,以防止系统上的其他用户读取它,但不会被加密或以其他方式保护。如果没有指定,凭据将搜索从<code>~/.git-credentials</code><code>$XDG_CONFIG_HOME/git/credentials</code>和证书将被写入到<code>~/.git-credentials</code>如果存在的话,或者<code>$XDG_CONFIG_HOME/git/credentials</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>如果没有明确设置<code>--file</code>,则有两个文件,其中
git-credential-store 将按优先顺序搜索凭据:</p></div></div><div class="doc-postil"><div class="c-markdown"><p>~/.git-credentials</p></div></div><div class="doc-postil"><div class="c-markdown"><p>用户特定的凭据文件。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>$XDG_CONFIG_HOME/git/credentials</p></div></div><div class="doc-postil"><div class="c-markdown"><p>第二个用户特定的凭证文件。如果<code>$XDG_CONFIG_HOME</code>没有设置或为空,<code>$HOME/.config/git/credentials</code>将被使用。如果<code>~/.git-credentials</code>具有匹配的凭证,则不会使用存储在此文件中的任何凭证。如果你有时使用不支持它的老版本 Git不建立这个文件是个好主意。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>对于凭证查找,将按照上面给出的顺序读取文件,发现第一个匹配的凭证优先于在列表下方的文件中找到的凭证。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>凭证存储将默认写入列表中的第一个现有文件。如果这些文件都不存在,<code>~/.git-credentials</code>将被创建并写入。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>擦除证书时,匹配的证书将从所有文件中删除。</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>示例</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>这个帮手的重点是减少你输入用户名或密码的次数。例如:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">$ git config credential.helper store
$ git push http://example.com/repo.git
Username: &lt;type your username&gt;Password: &lt;type your password&gt;[several days later]$ git push http://example.com/repo.git[your credentials are used automatically]</pre></div></div><div class="doc-postil"><div class="c-markdown"><h2>存储格式</h2></div></div><div class="doc-postil"><div class="c-markdown"><p><code>.git-credentials</code>文件以明文形式存储。每个凭证都按照以下形式存储在自己的行中:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">https://user:pass@example.com</pre></div></div><div class="doc-postil"><div class="c-markdown"><p>当 Git 需要对特定 URL 上下文进行身份验证时,凭证存储会将该上下文视为与凭证文件中的每个条目相匹配的模式。如果协议,主机名和用户名(如果我们已经有一个)匹配,那么密码将返回给 Git。有关更多信息请参阅 gitcredentials [7]中的配置讨论。</p></div></div></div>