重现步骤
go mod init gitlab.com/myorganisation/mysubgroup/myrepository
go get gitlab.com/myorganisation/mysubgroup/myrepository
出现错误:
go get gitlab.com/myorganisation/mysubgroup/repo1: git ls-remote -q https://gitlab.com/myorganisation/mysubgroup.git in /Volumes/CS/go/pkg/mod/cache/vcs/a96c83d4d1395bc931a1a8ac402e8d8e494cc85efa9081cab02316963aa836ed: exit status 128:
The project you were looking for could not be found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
最佳答案
[url "git@gitlab.com:"]
insteadOf = https://gitlab.com/
1.设置环境: GONOPROXY="gitlab.com/mycorp/*"
GONOSUMDB="gitlab.com/mycorp/*"
GOPRIVATE="gitlab.com/mycorp/*"
之后 go.mod 必须更新,一切都会开始正常工作。
关于go - 无法通过 SSH 安装 go 模块(私有(private)嵌套存储库),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63932562/