【问题标题】:git credential.helper=cache never forgets the password?git credential.helper=cache 永远不会忘记密码?
【发布时间】:2013-08-12 00:41:21
【问题描述】:

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

我已经设置好了:

git config credential.helper 'cache --timeout=600'

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

git 版本 1.7.10.4(在 Ubuntu)

我遇到错误了吗? (因为我看到了类似的问题,但我发现没有一个可以回答这个问题......)

编辑:还是我错过了什么?

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

【问题讨论】:

  • 而我正面临着与这个问题完全相反的问题——即使指定了 999999 的超时时间(约 11 天),它甚至半天都不记得了。

标签: git caching helper credentials


【解决方案1】:

问题 1:“希望我的密码被 git 遗忘”

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

回答

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

解释: Git配置在三个地方指定:

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

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

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

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

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

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'

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

  1. git config command
  2. git credential caching

【讨论】:

  • 对于较新版本的 git 将 --set 更改为 --add。 (请参阅git help config 中的文档)
  • @HisHighnessDog 我创建了$HOME/.config/git/credentials 并将credential.helper 设置为存储,当我执行git push 时它根本不使用。知道为什么吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-02-02
  • 1970-01-01
  • 2012-07-25
  • 1970-01-01
  • 2012-12-20
  • 2013-05-17
  • 2011-08-26
相关资源
最近更新 更多