git: 'credential-cache' 不是 git 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11693074/
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
git: 'credential-cache' is not a git command
提问by Big McLargeHuge
I followed these instructionsto the letter, including the part about password caching. It seems like the instructions are wrong, because every time I git push origin master
I get this error:
我按照这些说明进行操作,包括有关密码缓存的部分。似乎说明是错误的,因为每次git push origin master
我收到此错误时:
git: 'credential-cache' is not a git command. See 'get --help'.
... at which point I am forced to enter my username and password. After doing so, I am presented with the same error message again, followed by the output from git push
.
...此时我被迫输入我的用户名和密码。这样做之后,我再次看到相同的错误消息,然后是git push
.
Here is the contents of my .gitconfig file:
这是我的 .gitconfig 文件的内容:
[user]
name = myusername
email = [email protected]
[credential]
helper = cache
To be clear, after I installed Git and ran Git Bash, here is exactly what I typed:
需要明确的是,在我安装 Git 并运行 Git Bash 之后,这正是我输入的内容:
git config --global user.name "myusername"
git config --global user.email "[email protected]"
git config --global credential.helper cache
Please help. This is so frustrating!
请帮忙。这太令人沮丧了!
回答by Nate Cook
From a blog I found:
从一个博客我发现:
"This [git-credential-cache] doesn't work for Windows systems as git-credential-cache communicates through a Unix socket."
“这个 [git-credential-cache] 不适用于 Windows 系统,因为 git-credential-cache 通过 Unix 套接字进行通信。”
Git for Windows
适用于 Windows 的 Git
Since msysgit has been superseded by Git for Windows, using Git for Windowsis now the easiest option. Some versions of the Git for Windows installer (e.g. 2.7.4) have a checkbox during the install to enable the Git Credential Manager. Here is a screenshot:
由于 msysgit 已被 Git for Windows 取代,因此现在使用Git for Windows是最简单的选择。某些版本的 Git for Windows 安装程序(例如 2.7.4)在安装期间有一个复选框以启用 Git 凭据管理器。这是一个屏幕截图:
Still using msysgit? For msysgit versions 1.8.1 and above
还在使用 msysgit 吗?对于 msysgit 1.8.1 及以上版本
The wincred
helper was added in msysgit 1.8.1. Use it as follows:
该wincred
助手已在 msysgit 1.8.1 中添加。使用方法如下:
git config --global credential.helper wincred
For msysgit versions older than 1.8.1
对于早于 1.8.1 的 msysgit 版本
First, download git-credential-winstoreand install it in your git bin directory.
首先,下载git-credential-winstore并将其安装在您的 git bin 目录中。
Next, make sure that the directory containing git.cmd is in your Path environment variable. The default directory for this is C:\Program Files (x86)\Git\cmd on a 64-bit system or C:\Program Files\Git\cmd on a 32-bit system. An easy way to test this is to launch a command prompt and type git
. If you don't get a list of git commands, then it's not set up correctly.
接下来,确保包含 git.cmd 的目录在您的 Path 环境变量中。这个的默认目录是 C:\Program Files (x86)\Git\cmd 在 64 位系统上或 C:\Program Files\Git\cmd 在 32 位系统上。测试这一点的一种简单方法是启动命令提示符并键入git
. 如果您没有得到 git 命令列表,那么它的设置不正确。
Finally, launch a command prompt and type:
最后,启动命令提示符并键入:
git config --global credential.helper winstore
Or you can edit your .gitconfig file manually:
或者您可以手动编辑 .gitconfig 文件:
[credential]
helper = winstore
Once you've done this, you can manage your git credentials through Windows Credential Manager which you can pull up via the Windows Control Panel.
完成此操作后,您可以通过 Windows 凭据管理器管理您的 git 凭据,您可以通过 Windows 控制面板调出该管理器。
回答by A T
Looks like git
now comes with wincred
out-of-the-box on Windows (msysgit):
看起来git
现在wincred
在 Windows (msysgit) 上带有开箱即用的功能:
git config --global credential.helper wincred
Reference: https://github.com/msysgit/git/commit/e2770979fec968a25ac21e34f9082bc17a71a780
参考:https: //github.com/msysgit/git/commit/e2770979fec968a25ac21e34f9082bc17a71a780
回答by Ivandro Ismael Gomes Jao
First run git config --global credential.helper wincred
第一次运行 git config --global credential.helper wincred
Then go to: CONTROL PANEL\CREDENTIAL MANAGER\WINDOWS CREDENTIAL\GENERIC CREDENTIAL
然后去: CONTROL PANEL\CREDENTIAL MANAGER\WINDOWS CREDENTIAL\GENERIC CREDENTIAL
then click in add a credential in Internet or network address:
add git:https://
{username}.github.com
然后单击添加凭据Internet or network address:
添加git:https://
{username}.github.com
User:
{name}
User:
{姓名}
Password:
{Password}
Password:
{密码}
回答by Ikrom
回答by Saheed
There is now a much easier way to setup Git password caching by double clicking a small exeon Windows. The program is still based on git-credential-winstore
mentioned by the top voted answer, although the project has been moved from GitHub to http://gitcredentialstore.codeplex.com/
现在有一种更简单的方法来设置 Git 密码缓存,方法是双击Windows 上的一个小exe。该程序仍然基于git-credential-winstore
最高投票答案中提到的,尽管该项目已从 GitHub 移至http://gitcredentialstore.codeplex.com/
You can download the exe (and a binary for Mac) from this blog post: https://github.com/blog/1104-credential-caching-for-wrist-friendly-git-usage
您可以从这篇博文下载 exe(以及 Mac 的二进制文件):https: //github.com/blog/1104-credential-caching-for-wrist-friendly-git-usage
回答by TT--
A similar error is 'credential-wincred' is not a git command
类似的错误是 'credential-wincred' is not a git command
The accepted and popular answers are now out of date...
接受和流行的答案现在已经过时了......
wincred
is for the project git-credential-winstore which is no longer maintained.It was replaced by Git-Credential-Manager-for-Windowsmaintained by Microsoft open source.
wincred
用于不再维护的项目 git-credential-winstore 。
Download the release as zip file from link above and extract contents to
从上面的链接下载发布为 zip 文件并将内容解压缩到
\cygwin\usr\libexec\git-core
(or \cygwin64\usr\libexec\git-core
as it may be)
(或\cygwin64\usr\libexec\git-core
可能是)
Then enable it, (by setting the global .gitconfig
) - execute:
然后启用它,(通过设置 global .gitconfig
) - 执行:
git config --global credential.helper manager
How to use
如何使用
No further config is needed.
It works [automatically] when credentials are needed.
For example, when pushing to Azure DevOps, it opens a window and initializes an oauth2 flow to get your token.
不需要进一步的配置。
当需要凭据时,它 [自动] 工作。
例如,当推送到 Azure DevOps 时,它会打开一个窗口并初始化 oauth2 流以获取您的令牌。
ref:
参考:
回答by Sireesh Yarlagadda
回答by Johann
For the sake of others who come on this issue, I had this same problem in Ubuntu (namely that my passwords weren't caching, despite having set the option correctly, and getting the error git: 'credential-cache' is not a git command.
), until I found out that this feature is only available in Git 1.7.9 and above.
为了其他遇到此问题的人,我在 Ubuntu 中遇到了同样的问题(即我的密码没有缓存,尽管已正确设置选项并收到错误git: 'credential-cache' is not a git command.
),直到我发现此功能仅在 Git 1.7.9 及更高版本中可用。
Being on an older distribution of Ubuntu (Natty; I'm a stubborn Gnome 2 user) the version in the repo was git version 1.7.4.1. I used the following PPA to upgrade: https://launchpad.net/~git-core/+archive/ppa
在较旧的 Ubuntu 发行版(Natty;我是顽固的 Gnome 2 用户)上,repo 中的版本是 git 版本 1.7.4.1。我使用以下 PPA 进行升级:https: //launchpad.net/~git-core/+archive/ppa
回答by Andrew
For the sake of others having this issue - I landed here because I tried to get cute with how I set up a new github repository, but per the setup pagecredential helper doesn't work unless you clone a repository.
为了其他人遇到这个问题 - 我来到这里是因为我试图对我如何设置新的 github 存储库变得可爱,但是根据设置页面,除非您克隆存储库,否则凭据助手不起作用。
"Tip: The credential helper only works when you clone an HTTPS repository URL. If you use the SSH repository URL instead, SSH keys are used for authentication. This guide offers help generating and using an SSH key pair."
“提示:凭证助手仅在您克隆 HTTPS 存储库 URL 时起作用。如果您改用 SSH 存储库 URL,则 SSH 密钥将用于身份验证。本指南提供了生成和使用 SSH 密钥对的帮助。”
回答by Pini Cheyni
I fixed this issue by removing the credential
section from the config of specific project:
我通过credential
从特定项目的配置中删除该部分来解决此问题:
- Just typed:
git config -e
- Inside the editor I removed the whole section
[credential] helper = cache
.
- 刚刚输入:
git config -e
- 在编辑器中,我删除了整个部分
[credential] helper = cache
。
This removed the annoying message :
这删除了烦人的消息:
git: 'credential-cache' is not a git command. See 'git --help'.
git: 'credential-cache' is not a git command. See 'git --help'.