cache' is not a git command

I followed these instructions to 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: '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 .

Here is the contents of my .gitconfig file:

[user]
    name = myusername
    email = myusername@myemaildomain.com
[credential]
    helper = cache

To be clear, after I installed Git and ran Git Bash, here is exactly what I typed:

git config --global user.name "myusername"
git config --global user.email "myusername@myemaildomain.com"
git config --global credential.helper cache

Please help. This is so frustrating!


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 for Windows

Since msysgit has been superseded by Git for Windows, using Git for Windows is now the easiest option. Some versions of the Git for Windows installer (eg 2.7.4) have a checkbox during the install to enable the Git Credential Manager. Here is a screenshot:

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

Still using msysgit? For msysgit versions 1.8.1 and above

The wincred helper was added in msysgit 1.8.1. Use it as follows:

git config --global credential.helper wincred

For msysgit versions older than 1.8.1

First, download git-credential-winstore and install it in your git bin directory.

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)Gitcmd on a 64-bit system or C:Program FilesGitcmd 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.

Finally, launch a command prompt and type:

git config --global credential.helper winstore

Or you can edit your .gitconfig file manually:

[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.


Looks like git now comes with wincred out-of-the-box on Windows (msysgit):

git config --global credential.helper wincred

Reference : https://github.com/msysgit/git/commit/e2770979fec968a25ac21e34f9082bc17a71a780


I faced this problem while using AptanaStudio3 on windows7. This helped me:

git config --global credential.helper wincred

Code taken from here

链接地址: http://www.djcxy.com/p/22058.html

上一篇: 如何在gnome中使用git

下一篇: 缓存'不是一个git命令