git:"credential-cache"不是一个git命令 - 删除设置

23

尝试在Windows 7上设置git凭证缓存后,我现在想放弃这个想法并从git中删除此错误消息和设置。

git: 'credential-cache'不是git命令。

这个相关的问题 展示了如何通过安装额外的软件使凭证缓存工作来修复此错误 - 然而,我希望彻底删除此设置。

我该怎么做?

我已经尝试过: git config --global --remove-section credential-cache 和其他变化形式。 同时,在我的.git/config文件中也不存在。


你做了什么导致出现那个错误信息? - Greg Hewgill
@greg-hewgill git pull或push - Bradley Flood
8个回答

39

运行git config --global -e命令允许我从全局 git 配置中删除有问题的配置设置。

[credential]
helper = winstore

2
请务必检查您的本地(以及可能的系统)配置 - git config -e会加载当前存储库的配置。 您可以在多个位置定义凭据助手,这有助于我找出我在特定存储库中定义的第二个助手。 - Guy Starbuck
4
使用旧版本的Winstore或缓存可能无法正常工作。我按照[https://dev59.com/PGgt5IYBdhLWcg3w8h_e#11889392]中的建议使用`[credential] helper = wincred`,现在一切都很好。 - tie
1
@claudekennilol 可能他们删除了那些行(在VIM中,您可以按下“dd”来删除一行),然后通过键入:wq!保存了文件。 - Joseph Bleau
谢谢!这个很好用。我选择了wincred而不是winstore。 - Theo

15

我运行了git config --global -e,但它没有包含任何与凭据相关的部分。

然而,当我运行git config -e时,我确实发现有一个[credential]部分。

以下命令解决了我的问题。

git config --remove-section credential


我该如何感谢你并给你一些声望呢?这解决了一个令人崩溃的问题! - Machado

14

我也遇到了同样的错误:

$ git push -u origin master
git: 'credential-cache' is not a git command. See 'git --help'.
Branch master set up to track remote branch master from origin.
Everything up-to-date

所以我决定完全摆脱凭证缓存,我在Git bash中实现了这一点:

git config --global -e

然后我找到了

[credential]
    helper = cache

然后我删除了它,保存文件后再次尝试的结果是:

$ git push
Everything up-to-date

所以错误已经消失了。


谢谢。你能解释一下为什么出现了这个错误吗? - MasterJoe

7

再次确认 Bradley Flood 正确的说法,对我而言运行 git config --global -e 也起作用了。要补充一点,我删除的配置设置是:

    [credential]
    helper = winstore

4

我在Ubuntu中解决了这个问题,只需在终端中输入以下命令。

sudo git config --system --unset credential.helper manager

这对我很有用。


2
git config --system -e

按下'I'进行编辑;

删除代码。

[credential]
helper=xxxxxx

按下“Esc”关闭编辑器,输入“:wq”退出编辑器;


2
我遇到了同样的问题 -
$ git push
git: 'credential-user.name' is not a git command. See 'git --help'.
git: 'credential-user.email' is not a git command. See 'git --help'.
git: 'credential---replace-all' is not a git command. See 'git --help'.

所以,我决定摆脱所有的凭证缓存:

git config --global -e

在这里,您可以删除所有助手线路 -

(意思是可以删除所有辅助线)
[credential]
        helper = xxxx

保存后再尝试:

$ git push
Everything up-to-date

如果您想在本地计算机上存储git密码,以便不必每次输入,请尝试以下操作:
git config --global credential.helper store

这将会添加:
[credential]
        helper = store

然后重新尝试git push并输入用户名和密码。完成后,您就不再需要为git pullgit push命令提供用户名和密码。


0
我遇到了同样的错误,原因是我在本地仓库中创建了“feat_x”分支,而不是从远程“feat_x”拉取分支。解决方法是从本地仓库中删除该分支,然后再从远程拉取。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接