go执行 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.
登录后复制
这种问题往往是由于环境变量没有设置导致的。解决办法非常简单,只需添加以下环境变量即可:
export GIT_TERMINAL_PROMPT=1
登录后复制
添加环境变量后,再次执行go build,系统会提示输入git仓库的登录密码,验证通过后即可正常构建docker容器。
以上就是Docker Build 遇到 "fatal: could not read Username" 错误该如何解决?的详细内容,更多请关注php中文网其它相关文章!