【问题标题】:Git 'could not read Username' and 'could not read Password' accidental errorsGit“无法读取用户名”和“无法读取密码”意外错误
【发布时间】:2018-09-13 09:01:56
【问题描述】:

有时

git clone https://bitbucket.org/private/repo

导致错误:

克隆到'repo'...

错误:提示脚本执行失败(退出代码1)

致命:无法读取“https://bitbucket.org”的用户名:参数无效

而且有时会触发用户名输入提示。

即使指定了用户名,有时

git clone https://username:bitbucket.org/private/repo

导致错误:

克隆到'repo'...

错误:提示脚本执行失败(退出代码1)

致命:无法读取“https://username@bitbucket.org”的密码:参数无效

而且有时会触发密码输入提示。

git clone https://username:password@bitbucket.org/private/repo

每次都有效,但我试图避免以可读形式提供密码。

似乎 Git 有某种会话阻止它在到期前显示提示,但我没有确凿的证据。

Git 中是否存在影响这些提示的会话,如何清除它们?

如何让这个提示每次都显示?

git clone https://bitbucket.org/private/repo
Cloning into 'test'...
Username for 'https://bitbucket.org': username
Password for 'https://username@bitbucket.org':

我正在使用适用于 Windows 2.13 的 Git。我相信这个问题不是特定于当前存储库(Bitbucket),它也发生在其他存储库中。

有几个问题涉及这些错误,但答案不适用于这种情况。

【问题讨论】:

    标签: git git-clone git-for-windows


    【解决方案1】:

    首先,使用Git 2.17 for Windows: 凭证助手 (git config credential.helper) should be "manager" 检查问题是否仍然存在,它从 2.13 开始修复了很多错误

    如果您希望每次都被要求提供凭据,您可以通过以下方式阻止缓存这些凭据:

    git config --global unset credential.helper
    

    【讨论】:

    • 感谢您的回答,这可能是问题所在。我将有机会在短时间内检查它是如何工作的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-02
    • 1970-01-01
    • 2014-07-09
    • 2019-01-23
    • 2023-01-28
    相关资源
    最近更新 更多