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

Aqu*_*wer 12 git caching credentials helper

我想忘记密码,所以我必须再次输入密码.

我设置了这个:

git config credential.helper 'cache --timeout=600'
Run Code Online (Sandbox Code Playgroud)

但很久以后,几天,它仍然记得密码,并没有再问我...

git版本1.7.10.4(在Ubuntu)

我遇到过一个bug吗?(因为我看到类似的问题,但没有我发现答案这个...)

编辑:或者我错过了什么?

编辑:现在我知道commit是本地的,而且push很遥远.但我的提交(使用RabbitVCS Git nautilus插件)似乎正在执行,push因为远程仓库正在更新...当我发出时push,它会要求输入密码......但是使用该commit命令它不会要求并执行远程更新; 我检查了4小时前我commit更新了远程服务器:(

His*_*Dog 26

问题1:git要"忘记密码"

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

答案:

git config --unset-all credential.helper
git config --global --unset-all credential.helper
git config --system --unset-all credential.helper
Run Code Online (Sandbox Code Playgroud)

说明: Git配置在三个位置指定:

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

上面提到的命令将删除与存储库,用户和系统级别的凭证相关的所有设置......我认为这些设置可以回答您的问题.

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

git config --unset credential.helper 'cache'
git config --global --unset credential.helper 'cache'
git config --system --unset credential.helper 'cache'
Run Code Online (Sandbox Code Playgroud)

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

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'
Run Code Online (Sandbox Code Playgroud)

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

  1. git config命令
  2. git凭证缓存

  • 对于较新版本的git,将--set更改为--add。(请参阅`git help config`中的文档) (2认同)