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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18157583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 16:44:57  来源:igfitidea点击:

git credential.helper=cache never forgets the password?

gitcachinghelpercredentials

提问by Aquarius Power

I want my password to be forgotten, so I have to type it again.

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

I have setup this:

我已经设置了这个:

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

but much later on, several days, it still remembers the password and does not ask me it again...

但过了好几天,它仍然记得密码,不再问我...

git version 1.7.10.4 (at Ubuntu)

git 版本 1.7.10.4(在 Ubuntu 上)

did I run into a bug? (as I see similar questions but none I found that answers this...)

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

EDIT: or am I missing something?

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

EDIT: now I know commitis local, and pushis remote. BUT my commits (with RabbitVCS Git nautilus addon) seem to be performing the pushas remote repo is being updated... When I issue push, it do asks for password... but with the commitcommand it does not ask AND perform the remote update; I checked that 4 hours ago my commitupdated the remote server :(

编辑:现在我知道commit是本地的,并且push是远程的。但我的提交(与RabbitVCS Git的鹦鹉螺插件),似乎是在执行push远程回购正在更新...当我发布push,它做询问密码...但与commit命令它不问,并执行远程更新; 我在 4 小时前检查过我commit更新了远程服务器:(

回答by HisHighnessDog

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

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

Problem 2 (implied): contradictory configuration settings

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

Answer:

回答

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

Explanation:Git configuration is specified in three places:

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

  1. (repository_home)/.git/config...........................for the subject repository.
  2. ~/.gitconfig..........................for this particular user.
  3. /etc/gitconfig.......................for all users on this system.
  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.

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

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

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

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 config command
  2. git credential caching
  1. git 配置命令
  2. git 凭证缓存