gpt4 book ai didi

git - 当找不到远程存储库时,防止 git pull 从 github 请求用户名密码

转载 作者:行者123 更新时间:2023-12-04 14:33:00 24 4
gpt4 key购买 nike

我查看了所有有关为“git pull”配置用户名/密码的问题,但没有解决远程存储库为 404 时的问题。

我过去某个时候从 github 上 git clone 了一个仓库。无论出于何种原因,存储库所有者已删除存储库,并且 git pull 失败。不过在失败之前,git pull 会询问用户名和密码。

发生这种情况是因为我有一个克隆的 github git repos 目录,我试图通过进入每个目录并执行“git pull”的 shell 脚本来更新它们。

$ git pull
ksshaskpass: cannot connect to X server
error: unable to read askpass response from '/usr/lib/ssh/ssh-askpass'
Username for 'https://github.com':
ksshaskpass: cannot connect to X server
error: unable to read askpass response from '/usr/lib/ssh/ssh-askpass'
Password for 'https://github.com':
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/[ ... ]

最佳答案

我发现自己处于类似情况,我的解决方案是通过以下方式为 Git 设置伪造的凭证提供程序:

export GIT_ASKPASS="/bin/true"

这会导致 pull/克隆立即失败,而不是提示输入用户名和密码。这有点 hack,但我找不到任何其他简单的方法来阻止提示。

关于git - 当找不到远程存储库时,防止 git pull 从 github 请求用户名密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29104651/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com