我已经开始从事Golang项目了。使用 make 构建时,我收到以下错误:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
为了解决这个问题,我在经历了类似的帖子后做了以下工作,在 github 私有存储库的"终端提示禁用"错误中得到结果:
export GIT_TERMINAL_PROMPT=1
但这并没有解决问题,现在它似乎在无限循环中询问用户名和密码。
我的 git 配置如下:
$git config --list
remote.origin.url=git@github.com:GolangProjects/Project1.git
即使在这个配置之后,为什么它继续使用 https 而不是 SSH,没有得到任何线索。请帮忙。
请改为创建一个 SSH 密钥,并将其用作 git 存储库的默认登录方法。 您可以点击此链接创建用于在计算机上进行身份验证的 ssh 密钥:
生成新的 SSH 密钥并将其添加到 ssh 代理
然后使用它来默认您的登录方法使用 ssh 密钥而不是您的凭据:
git config --global url.ssh://git@github.com/.insteadOf https://github.com/
您的导入之一是否来自私有存储库?
如果是这样,你需要让Go知道它。
go env -w GOPRIVATE=github.com/mycompany/*
或
export GOPRIVATE=*.corp.example.com,github.com/mycompany/*
(我有同样的问题,并从 https://stackoverflow.com/a/60323360/20837494
与git fetch
有同样的问题:
Fetching the repository
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/master*:refs/remotes/origin/master* +refs/tags/master*:refs/tags/master*
Error: fatal: could not read Username for 'https://github.com': terminal prompts disabled
The process '/usr/bin/git' failed with exit code 128
Waiting 14 seconds before trying again
若要解决此问题,必须更新存储库secrets
令牌。