且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

git credential.helper=cache 永远不会忘记密码?

更新时间:2023-09-10 23:18:34

问题 1:git希望我的密码被忘记"

Problem 1: "want my password to be forgotten" by git

问题 2(隐含):矛盾的配置设置

答案:

git config --unset-all credential.helper
git config --global --unset-all credential.helper
git config --system --unset-all credential.helper

说明:Git配置在三个地方指定:

Explanation: Git configuration is specified in three places:

  1. (repository_home)/.git/config.................................. 用于主题存储库.
  2. ~/.gitconfig......................................对于这个特定用户.
  3. /etc/gitconfig.......................适用于该系统上的所有用户.

上面提到的命令将删除与存储库、用户和系统级别的凭据相关的所有设置......(我认为)回答了您的问题.

The commands noted above will remove all settings related to credentials at the repository, user and system level... which (I think) answers your question.

但是,听起来您的问题可能仅限于与 one credential.helper、缓存 选项相关的某种配置矛盾.如果您只想重置该选项,请执行以下操作:

However, it sounds like your problem may be limited to having some sort of configuration contradiction related to one option of credential.helper, cache. If you'd prefer to reset only that option, do this:

git config --unset credential.helper 'cache'
git config --global --unset credential.helper 'cache'
git config --system --unset credential.helper 'cache'

...然后将超时设置在适当的级别,以下任一项:

... then set the timeout at the appropriate level, any of:

git config --set credential.helper 'cache --timeout=600'
git config --global --set credential.helper 'cache --timeout=600'
git config --system --set credential.helper 'cache --timeout=600'

有关更多信息,请参阅此处的优秀文档:

For more, see the excellent documentation here:

  1. git 配置命令
  2. git 凭据缓存