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

Dav*_*edy 249 git msysgit git-config git-bash

我按照这些说明来写信,包括有关密码缓存的部分.似乎说明是错误的,因为每次git push origin master我收到此错误:

git: 'credential-cache' is not a git command. See 'get --help'.
Run Code Online (Sandbox Code Playgroud)

...此时我被迫输入我的用户名和密码.这样做之后,我再次收到相同的错误消息,然后是输出git push.

这是我的.gitconfig文件的内容:

[user]
    name = myusername
    email = myusername@myemaildomain.com
[credential]
    helper = cache
Run Code Online (Sandbox Code Playgroud)

要清楚,在我安装Git并运行Git Bash之后,这就是我输入的内容:

git config --global user.name "myusername"
git config --global user.email "myusername@myemaildomain.com"
git config --global credential.helper cache
Run Code Online (Sandbox Code Playgroud)

请帮忙.这太令人沮丧了!

Nat*_*ook 313

我发现的博客:

"这个[git-credential-cache]不适用于Windows系统,因为git-credential-cache通过Unix套接字进行通信."

Git for Windows

由于msysgit已被Git for Windows取代,因此使用Git for Windows现在是最简单的选择.某些版本的Git for Windows安装程序(例如2.7.4)在安装期间有一个复选框以启用Git Credential Manager.这是一个截图:

Git For Windows 2.7.4安装向导的屏幕截图

仍在使用msysgit?对于msysgit版本1.8.1及更高版本

wincred在msysgit 1.8.1加入帮手.使用方法如下:

git config --global credential.helper wincred
Run Code Online (Sandbox Code Playgroud)

对于早于1.8.1的msysgit版本

首先,下载git-credential-winstore并将其安装在您的git bin目录中.

接下来,确保包含git.cmd的目录位于Path环境变量中.其默认目录是64位系统上的C:\ Program Files(x86)\ Git\cmd或32位系统上的C:\ Program Files\Git\cmd.测试这个的简单方法是启动命令提示符并键入git.如果你没有得到git命令列表,那么它没有正确设置.

最后,启动命令提示符并键入:

git config --global credential.helper winstore
Run Code Online (Sandbox Code Playgroud)

或者您可以手动编辑.gitconfig文件:

[credential]
    helper = winstore
Run Code Online (Sandbox Code Playgroud)

完成此操作后,您可以通过Windows Credential Manager管理您的git凭据,您可以通过Windows控制面板进行管理.

  • 仅供参考我必须使用明确的管理员权限进行安装.没有它,我得到错误"git:'credential-winstore'不是git命令.请参阅'git --help'".我的.gitconfig现在看起来有点不同了,[凭证行]有"helper =!'C:\\ Users \\ Malachi \\ AppData \\ Roaming \\ GitCredStore \\ git-credential-winstore.exe'' (8认同)
  • http://gitcredentialstore.codeplex.com/包含常见问题解答.它帮助我成功安装了winstore.二进制崩溃除非你从git-bash运行它. (4认同)
  • git-credential-winstore工具对我不起作用.它曾经,但突然我得到了整个地方的提示.我检查了.git-config和Windows Credential Manager,应该是一切.它根本不起作用,我真的不知道为什么.:( (3认同)

A T*_*A T 56

看起来git现在wincred在Windows上开箱即用(msysgit):

git config --global credential.helper wincred
Run Code Online (Sandbox Code Playgroud)

参考:https: //github.com/msysgit/git/commit/e2770979fec968a25ac21e34f9082bc17a71a780

  • 这个问题7年前就有答案了。不确定 msysgit 的当前状态是什么 (2认同)

Iva*_*ael 26

第一次运行 git config --global credential.helper wincred

然后去: CONTROL PANEL\CREDENTIAL MANAGER\WINDOWS CREDENTIAL\GENERIC CREDENTIAL

然后点击添加凭据Internet or network address: 添加git:https://{username}.github.com

User: {名称}

Password: {密码}

  • `%windir%\ explorer.exe shell ::: {1206F5F1-0569-412C-8FEC-3204630DFB70}`来自控制台也将启动Credential Manager. (3认同)
  • 凭据管理器位于Windows 7中的用户帐户和家庭安全中 (2认同)

Ikr*_*rom 20

我在windows7上使用AptanaStudio3时遇到了这个问题.这对我有所帮助:

git config --global credential.helper wincred
Run Code Online (Sandbox Code Playgroud)

代码来自这里


小智 11

这对我有用:

git 凭证管理器核心配置


Sah*_*eed 10

现在,通过双击Windows上的小exe,可以更轻松地设置Git密码缓存.git-credential-winstore尽管该项目已从GitHub转移到http://gitcredentialstore.codeplex.com/,但该程序仍然基于最高投票答案.

您可以从以下博客文章下载exe(以及Mac的二​​进制文件):https://github.com/blog/1104-credential-caching-for-wrist-friendly-git-usage


Pin*_*yni 10

我通过credential从特定项目的配置中删除该部分来解决此问题:

  • 刚刚输入: git config -e
  • 在编辑器中,我删除了整个部分[credential] helper = cache

这删除了烦人的消息:

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

  • 我从上面尝试了许多解决方案,这是唯一有效的解决方案。我刚刚去了我的 .git 文件夹,打开了配置文件并删除了 [credential] helper = global (我不小心将它设置为“全局”)。非常感谢 Pini Cheyni。 (2认同)

TT-*_*T-- 8

类似的错误是 'credential-wincred' is not a git command

公认的流行答案现已过时...

wincred适用于不再维护的项目git-credential-winstore 。

它由Microsoft开源维护的WindowsGit-Credential-Manager-for Windows取代。

从上面的链接下载该版本作为zip文件并将内容提取到

\cygwin\usr\libexec\git-core
Run Code Online (Sandbox Code Playgroud)

(或者\cygwin64\usr\libexec\git-core可能是)

然后启用它(通过设置global .gitconfig)-执行:

git config --global credential.helper manager
Run Code Online (Sandbox Code Playgroud)

如何使用

无需进一步的配置。

当需要凭据时,它可以自动运行。

例如,当推送到Azure DevOps时,它将打开一个窗口并初始化oauth2流以获取令牌。

参考:


Ved*_*ngh 8

当我尝试从 master 分支使用命令“git pull”时,我也遇到了类似的错误。

Error: "git: 'credential-manager' is not a git command. See 'git --help'." 
Run Code Online (Sandbox Code Playgroud)

我执行了以下两个命令,问题得到解决。

$ git config --global --unset credential.helper
$ git config credential.helper store
Run Code Online (Sandbox Code Playgroud)


Sir*_*dda 7

首先找到您用于GIT的版本.

使用此命令:git --version

如果你有一个比1.7.10更新的版本.

然后只需使用此命令即可.

git config --global credential.helper wincred
Run Code Online (Sandbox Code Playgroud)

参考


Joh*_*ann 6

为了解决这个问题的其他人,我在Ubuntu中遇到了同样的问题(即我的密码没有缓存,尽管已正确设置选项并得到错误git: 'credential-cache' is not a git command.),直到我发现此功能仅为在Git 1.7.9及以上版本中可用.

在Ubuntu(Natty;我是一个顽固的Gnome 2用户)的旧版本中,repo中的版本是git版本1.7.4.1.我使用以下PPA进行升级:https: //launchpad.net/~git-core/+archive/ppa


And*_*rew 5

为了其他人有这个问题 - 我在这里登陆是因为我试图让我对如何设置一个新的github存储库变得可爱,但是根据设置页面,凭证帮助程序不起作用,除非您克隆存储库.

"提示:凭证助手仅在克隆HTTPS存储库URL时有效.如果使用SSH存储库URL,则使用SSH密钥进行身份验证.本指南提供了生成和使用SSH密钥对的帮助."