目录 搜索
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
文字

名称

git-credential-store  - 帮助者将证书存储在磁盘上

概要

git config credential.helper 'store [options]'

描述

注意

使用这个帮助程序会将你的密码存储在磁盘上,只受文件系统权限保护。如果这不是一个可以接受的安全权衡,请尝试使用 git-credential-cache1,或者找到一个与操作系统提供的安全存储集成的帮助器。

该命令将无限期地将证书存储在磁盘上供将来的 Git 程序使用。

你可能不想直接调用这个命令; 它意味着被 git 的其他部分用作凭证助手。请参阅 gitcredentials [7]或EXAMPLES以下。

选项

--file=<path>

使用<path>查找和存储凭据。该文件将设置文件系统权限,以防止系统上的其他用户读取它,但不会被加密或以其他方式保护。如果没有指定,凭据将搜索从~/.git-credentials$XDG_CONFIG_HOME/git/credentials和证书将被写入到~/.git-credentials如果存在的话,或者$XDG_CONFIG_HOME/git/credentials如果它存在,前者没有。另请参阅文件。

文档

如果没有明确设置--file,则有两个文件,其中 git-credential-store 将按优先顺序搜索凭据:

~/.git-credentials

用户特定的凭据文件。

$XDG_CONFIG_HOME/git/credentials

第二个用户特定的凭证文件。如果$XDG_CONFIG_HOME没有设置或为空,$HOME/.config/git/credentials将被使用。如果~/.git-credentials具有匹配的凭证,则不会使用存储在此文件中的任何凭证。如果你有时使用不支持它的老版本 Git,不建立这个文件是个好主意。

对于凭证查找,将按照上面给出的顺序读取文件,发现第一个匹配的凭证优先于在列表下方的文件中找到的凭证。

凭证存储将默认写入列表中的第一个现有文件。如果这些文件都不存在,~/.git-credentials将被创建并写入。

擦除证书时,匹配的证书将从所有文件中删除。

示例

这个帮手的重点是减少你输入用户名或密码的次数。例如:

$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>Password: <type your password>[several days later]$ git push http://example.com/repo.git[your credentials are used automatically]

存储格式

.git-credentials文件以明文形式存储。每个凭证都按照以下形式存储在自己的行中:

https://user:pass@example.com

当 Git 需要对特定 URL 上下文进行身份验证时,凭证存储会将该上下文视为与凭证文件中的每个条目相匹配的模式。如果协议,主机名和用户名(如果我们已经有一个)匹配,那么密码将返回给 Git。有关更多信息,请参阅 gitcredentials [7]中的配置讨论。

上一篇: 下一篇: