我注意到,在最新版本的Git中,默认现在是弹出一个“Git凭证管理器for Windows”对话框,而不是每次在Bash提示符中提示我输入密码。

我真的很讨厌这种行为。我如何禁用它,然后回到每次在Bash shell中输入密码?

顺便说一下,我不希望Git以任何方式缓存我的凭据,无论是通过Windows凭据还是一些内部守护进程。我想禁用所有凭据缓存。


当前回答

在“user”文件夹下,c://user,,查看“。文件,然后删除HTTP和代理行。

其他回答

我在Ubuntu 18.10 (Cosmic Cuttlefish)上遇到了同样的问题,无法使用任何正常方法删除。 我使用git config -global -unset credential。帮手,这似乎奏效了。

我不得不使用VSTS的另一个选项:

Git配置——全局凭据。modalprompt假

我想使用凭据管理器进行正常使用,但我有脚本,我显然不希望从git.exe中得到任何提示。这是我如何从我的脚本调用Git:

set GIT_TERMINAL_PROMPT=0
git -c core.askpass= -c credential.helper= <command> ...

这样,脚本总能看到“正确的”无提示设置,而不必调整任何配置。

(Git for Windows 2.13.3)


我发现的一个变体可能也很方便,那就是设置:

set GCM_INTERACTIVE=never
# Or: git config --global credential.interactive never

set GIT_TERMINAL_PROMPT=0
git.exe -c core.askpass= -c credential.helper=manager <command> ...

但是请注意git.exe -c credential.interactive=never <命令>… 不工作(似乎-c的东西没有路由到Git凭证管理器的Windows或其他)。

这样,您可以使用GCMfW,但它永远不会提示您;它将只查找凭据,这在非交互式环境中非常有用。

我可以使用卸载选项卸载Git Credential Manager for Windows:

git-credential-manager.exe uninstall

在C:\Program Files\Git\mingw64\libexec\git-core中执行该命令

如果您不想删除或卸载凭据管理器:请参阅https://serverfault.com/questions/544156/git-clone-fail-instead-of-prompting-for-credentials/1054253#answer-1054253以获得适合我的解决方案。

说明等,在该页面(链接,以防止重复的内容在同一网站家族)。


TL;DR:这现在位于我的自动bash脚本之上:

# https://serverfault.com/questions/544156/git-clone-fail-instead-of-prompting-for-credentials
export GIT_TERMINAL_PROMPT=0
# next env var doesn't help...
export GIT_SSH_COMMAND='ssh -oBatchMode=yes'
# these should shut up git asking, but only partly: the X-windows-like dialog doesn't pop up no more, but ...
export GIT_ASKPASS=echo
export SSH_ASKPASS=echo
# We needed to find *THIS* to shut up the bloody git-for-windows credential manager: 
# https://stackoverflow.com/questions/37182847/how-do-i-disable-git-credential-manager-for-windows#answer-45513654
export GCM_INTERACTIVE=never

证书管理器棺材上的最后一颗钉子是Martin Ba上面回答的唯一的位(GCM_INTERACTIVE):我如何禁用Windows的Git证书管理器?