我有一个 Go 项目,它需要来自私有(private) GitLab 存储库(如 git.mydomain.com/myteam/category/subcategory/project.git)的一些依赖项。
但我收到了这个错误。
ensure Solve(): remote repository at https://git.mydomain.com/myteam/category.git does not exist or is inaccessible: : exit status 128
最佳答案
这个问题在 GitLab support tracker 上有详细的讨论。 .
TL;博士;这是(故意)broken for private repos :
Is [your group] private? If so, this is expected behavior, and I would recommend reading the discussion from #1337 (comment 36293613) onwards. In this case, we have decided to maximize security/privacy at the slight expense of usability. The recommended workaround is to specifically add .git to your URL.
我发现的唯一解决方案是使用
go get
's support for .netrc
,解决了这两个问题 dep
,以及现代 Go 模块。~/.netrc
文件: machine gitlab.com
login <your gitlab username>
password <the token created in step 1>
.netrc
归档一点: chmod 600 ~/.netrc
现在应该可以工作了:
dep ensure -add gitlab.com/<company>/<subgroup>/<project>
如果您使用的是私有(private) GitLab 安装,我相信您可以替换 gitlab.com
在适用的情况下使用适当的主机名。
关于go - 如何将 Go dep 与 GitLab 子组一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56670381/