在 git bash for windows 中,用户名和/或密码会在单独的 UI pop 提示中询问,如下所示。
点击取消时,您会看到以下基于 shell 的提示,可以在其中输入相同的用户名。
有什么方法可以禁用这些提示? 我仍然想输入我的用户名和密码,但是我想通过基于 shell 的提示输入,而不是基于 UI 的提示输入。
使用这里的建议没有帮助。 How to undo git config --system core.askpass git-gui--askpass
最佳答案
尝试全局设置变量core.askPass
(在你的配置文件中)
$ git config --global core.askPass true
或者使用 -c
开关只为一个命令覆盖它
$ git -c core.askPass=true clone <https_url>
参见:https://git-scm.com/docs/gitcredentials
If a helper outputs a quit attribute with a value of true or 1, no further helpers will be consulted, nor will the user be prompted (if no credential has been provided, the operation will then fail).
注意:使用 git config --global --unset core.askPass
取消设置 core.askPass
没有帮助。它需要像上面一样设置为 true
。
2021-10-22 更新:
最初的答案建议设置空字符串 ""
,但至少在 Ubuntu 上这不起作用,文档还描述了助手应该输出 true
或 1
。
关于Git Windows 禁用密码提示 UI 但从 shell 获取密码提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34396390/