在某些git配置中陷入混乱?

时间:2018-11-03 20:50:33

标签: git

我在Windows上使用Git遇到了问题。

如果我推送本地更改,则会出现以下错误:

git: 'credential-credential-store' is not a git command. See 'git --help'.

据我了解,这是配置中的一行,但是我检查了--local,-system和--global,它们都不包含该错误。

global包含相同的值,但没有错误:

[credential]
helper = credential-store

在这一点上,我对于正在使用哪个文件一无所知。

在Windows的Linux子系统中使用git不会给我错误。

我对此很陌生,真的很想了解这里发生了什么。

2 个答案:

答案 0 :(得分:0)

Git允许您使用“帮助程序”来管理您的远程登录信息,因此您不必每次输入时都键入它。此配置有几个不同的选项,它们取决于操作系统。我认为git抛出错误是因为它试图运行git credential-credential-store,这不是有效的git命令。

如果要将凭据存储在文件中,则可以运行

git config --global credential.helper "store --file ~/.gitcredential"

这会将您的git凭据存储在主目录中的文件中。 Windows上的一个更好的选择可能是使用

git config --global credential.helper manager

这将设置git以使用git Git Credential Manager,它在Windows上提供,可帮助管理各种类型的登录。

答案 1 :(得分:0)

在这里回答我自己的问题,因为我发现了错误:

git push在配置的“ helper = store”的“ store”属性中添加“ credential-”以形成命令。

因此,这将导致“凭据存储”。

出于某种原因,我不知道我的配置中已经有“ helper = credential-store”,因此使用git push将其再次添加,形成“ credential-credential-store”,这显然不是有效的命令。

在配置中删除“凭据-”即可解决该问题。

相关问题