go执行docker构建遇到的问题:git ls-remote出错
在执行docker构建时,您可能会遇到如下的错误提示:
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.
造成此错误的原因是go在执行docker构建时需要访问远程git仓库,而您的环境中没有设置正确的git环境变量。
解决方案:
要解决此问题,请执行以下操作:
export GIT_TERMINAL_PROMPT=1
此时,将提示您输入git仓库的用户名和密码。输入正确的凭证后,go就可以访问远程git仓库,构建docker容器。
以上就是Go执行Docker构建时出现git ls-remote错误,如何解决?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号