首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法运行go安装与私有gitlab回购

无法运行go安装与私有gitlab回购
EN

Stack Overflow用户
提问于 2021-03-24 23:55:25
回答 1查看 1.1K关注 0票数 1

我在试着建立一个围棋服务器的码头形象。源代码在gitlab.com上。在此基础上,我在Dockerfile中添加了git配置

代码语言:javascript
复制
#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访问呢?我尝试了许多解决办法,但都没有成功。

谢谢

EN

回答 1

Stack Overflow用户

发布于 2022-02-18 21:32:49

我遇到了同样的问题:

代码语言:javascript
复制
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

代码语言:javascript
复制
[url "ssh://git@gitlab.com/"]
    insteadOf = https://gitlab.com/

如建议的:https://gitlab.com/gitlab-org/gitlab-foss/-/issues/65681https://go.dev/doc/faq#git_https

然而,这些解决方案目前都不适用于我。

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66791120

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档