我严格遵守了这些说明,包括关于密码缓存的部分。看起来指令是错误的,因为每次我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

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


当前回答

我们的Azure DevOps存储库在域名更改后也遇到了同样的问题,即从@xy.com更改为@xyz.com。为了解决这个问题,我们生成了一个新的个人访问令牌,具有以下权限:

代码:读写 包装:阅读

然后我们打开Windows凭据管理器,添加一个新的通用Windows凭据,详细信息如下:

Internet或网络地址:"git:{projectname}@dev.azure.com/{projectname}" -或者你可以在这里使用你的git存储库名称。 用户名:“个人访问令牌” 密码:{生成的个人访问令牌}

后来我们所有的git操作都恢复正常了。希望这能帮助到其他人!

其他回答

另一个有效的解决方法是:

1-进入控制面板,像这样添加github.com的凭据:

2-进入CMD并输入这些命令:

a- cd %localappdata%\Atlassian\SourceTree\git_local\mingw32\bin\ B - git.exe配置——编辑——系统 C -正确的最后一行: 助手=经理 d-保存新的配置文件,点击CTRL+C,然后输入:wq,然后按Enter

这对我来说太完美了!

我知道我有点晚了,但我也遇到了同样的问题 在我的git配置中,我有两个条目凭据…

在我的。gitconfig文件中

[credential]
helper = cached
[credentials]
helper = wincred

解决方案:更改我的.gitconfig文件的设置如下

[credential]
helper = wincred
[credentials]
helper = wincred

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

git config --global credential.helper wincred

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

执行git config——global credential命令。辅助wincred 转到:控制面板\证书管理器\WINDOWS证书\通用证书 在Internet或网络地址中单击“添加证书”:add git: https:// .github.com {username} 用户:{名称} 密码密码:{}

我通过从特定项目的配置中删除凭据部分来修复这个问题:

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

这就消除了恼人的信息:

'credential-cache'不是Git命令。参见'git -help'。