我严格遵守了这些说明,包括关于密码缓存的部分。看起来指令是错误的,因为每次我git push origin master都会得到这个错误:

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

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

下面是我的.gitconfig文件的内容:

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

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

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

请帮助。这太令人沮丧了!


当前回答

我在windows7上使用AptanaStudio3时遇到了这个问题。这帮助了我:

git config --global credential.helper wincred

其他回答

为了让其他人知道这个问题,我在Ubuntu中也遇到了同样的问题(即我的密码没有缓存,尽管已经正确地设置了选项,并且得到了错误git: '凭据-缓存'不是git命令),直到我发现这个功能只在git 1.7.9及以上版本中可用。

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

我也得到类似的错误,当我试图使用命令“git拉”从主分支。

Error: "git: 'credential-manager' is not a git command. See 'git --help'." 

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

$ git config --global --unset credential.helper
$ git config credential.helper store

在我的案例中,这个命令解决了这个问题:

git config --global credential.helper manager-core --replace-all

使用新的网络核心凭据管理器。

现在有一种更简单的方法来设置Git密码缓存,只需双击Windows上的一个小exe即可。该程序仍然基于投票最多的答案所提到的git-credential-winstore,尽管该项目已经从GitHub移动到http://gitcredentialstore.codeplex.com/

你可以从这篇博客上下载exe(和Mac的二进制文件):https://github.com/blog/1104-credential-caching-for-wrist-friendly-git-usage

我在windows7上使用AptanaStudio3时遇到了这个问题。这帮助了我:

git config --global credential.helper wincred