Git Windows 禁用密码提示 UI 但从 shell 获取密码提示

标签 git git-bash

在 git bash for windows 中,用户名和/或密码会在单独的 UI pop 提示中询问,如下所示。

Username Prompt

点击取消时,您会看到以下基于 shell 的提示,可以在其中输入相同的用户名。

Shell based username prompt

有什么方法可以禁用这些提示? 我仍然想输入我的用户名和密码,但是我想通过基于 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 上这不起作用,文档还描述了助手应该输出 true1

关于Git Windows 禁用密码提示 UI 但从 shell 获取密码提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34396390/

相关文章:

java - OpenShift EGIT Eclipse

git - 我如何 git rebase 第一次提交?

linux - Windows 电脑上的 Git Bash 和 Linux 有什么关系?

windows - 如何缩短 Git Bash 提示 (Windows)

git - 有没有办法强制创建远程存储库?

git - git 是否需要存在于服务器上才能使用它?

git - 如何删除 merge 提交

windows - robocopy 将选项视为文件

git - merge 分支后推送时无法解析引用 refs/refs/remotes/origin/branch

node.js - Git Bash 和 webpack