php中文网

Go 执行 Docker Build 报错:如何解决 git ls-remote 错误?

php中文网

go 执行 docker build 报错

在构建 docker 容器时,你可能遇到这样的错误:

answer imports
github.com/answerdev/answer-basic-connector: module github.com/answerdev/answer-basic-connector: git ls-remote -q origin in /go/pkg/mod/cache/vcs/2eb01f4aadbb28882970063faa18a6e807b04bd4da767dddd04d856f1fa4e95b: exit status 128:
fatal: could not read username for 'https://github.com': terminal prompts disabled
confirm the import path was entered correctly.
if this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

解决方案:

要解决此问题,请增加 git 环境变量:

export GIT_TERMINAL_PROMPT=1

再次执行 go build,系统将提示你输入 git 仓库的登录密码以进行验证。输入密码后,构建过程即可正常进行。

以上就是Go 执行 Docker Build 报错:如何解决 git ls-remote 错误?的详细内容,更多请关注php中文网其它相关文章!