我在试着建立一个围棋服务器的码头形象。源代码在gitlab.com上。在此基础上,我在Dockerfile中添加了git配置
#Start from a Debian image with the latest version of Go installed
FROM golang:latest
ENV READIUM_LICENSE_CONFIG /config/config.yaml
ENV REPO=gitlab.com/gara-project/back-end-micro-services/lcp-server/readium-lcp-server
ADD src /src
ADD lcp-server/entrypoint.sh /entrypoint.sh
RUN git config \
--global \
url."https://username:token@gitlab.com".insteadOf \
"https://gitlab.com"
RUN GIT_TERMINAL_PROMPT=1
RUN GOPATH=/ go install $REPO@latest
RUN chmod a+x /entrypoint.sh
VOLUME ["/files", "/config"]
CMD ["/bin/lcpserver"]
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8989用户名和令牌是正确的,因为我尝试了一个git克隆。当我运行docker文件的构建时
安装gitlab.com/gara-project/back-end-micro-services/lcp-server/readium-lcp-server@latest:模块gitlab.com/gara-project/back-end-micro-services/lcp-server/readium-lcp-server: git ls- /pkg/mod/cache/vcs/389aeee014594569659e179bbd3e2519e3cd572a0adc7faf372d5fdbcb7d22bd:退出状态128中的远程-q源: remote:找不到您正在寻找的项目。致命:未找到存储库“https://xxxx:xxxxxx@gitlab.com/gara-project/back-end-micro-services.git/”
我不知道为什么go是在寻找gara-project/back-end-micro-services.git而不是gitlab.com/gara-project/back-end-micro-services/lcp-server/readium-lcp-server 2- -我怎么能设置我的gitlab访问呢?我尝试了许多解决办法,但都没有成功。
谢谢
发布于 2022-02-18 21:32:49
我遇到了同样的问题:
go install gitlab.com/foo/bar/baz@latest
go install: gitlab.com/foo/bar/baz@latest: module gitlab.com/foo/bar/baz: git ls-remote -q origin in /Users/user/go/pkg/mod/cache/vcs/<hash>: exit status 128:
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.com/foo/bar.git/' not found显然,go install找错地方了。
所建议的是:
go env -w "GOPRIVATE=gitlab.com/foo/*" (让go查看“正确”的machine gitlab.com username <USERNAME> password <GITLAB_PAT>,或~/.gitconfig具有:H 213f 214[url "ssh://git@gitlab.com/"]
insteadOf = https://gitlab.com/如建议的:https://gitlab.com/gitlab-org/gitlab-foss/-/issues/65681和https://go.dev/doc/faq#git_https
然而,这些解决方案目前都不适用于我。
https://stackoverflow.com/questions/66791120
复制相似问题