[英]Cannot install private Go module
I have a private project which uses a private module at github.com/company/company-product
.我有一个私有项目,它在
github.com/company/company-product
使用私有模块。 When I try to build the project, I get:当我尝试构建项目时,我得到:
go: github.com/company/company-product@v1.0.4: reading github.com/company/company-product/go.mod at revision v1.0.4: unknown revision v1.0.4
Things I have tried:我尝试过的事情:
go env -w GO111MODULE=on
go env -w GOPRIVATE=github.com/company/company-product
export GOPRIVATE=github.com/company/*
export GONOPROXY=github.com/company/*
export GONOSUMDB=github.com/company/*
ssh://git@github.com/
instead of https://github.com/
ssh://git@github.com/
而不是https://github.com/
ssh://$PERSONAL_ACCESS_TOKEN@github.com/
instead of https://github.com/
ssh://$PERSONAL_ACCESS_TOKEN@github.com/
而不是https://github.com/
$GOPATH/pkg
$GOPATH/pkg
中的所有内容go clean
go mod download
, go mod tidy
, go mod vendor
(which all produce the above error) go mod download
, go mod tidy
, go mod vendor
(都产生上述错误) And yet I still get the same error.但是我仍然遇到同样的错误。
It looks like the key was to do things in a certain order:看起来关键是按照一定的顺序做事:
github.com/company/*
github.com/company/*
$GOPATH/pkg
$GOPATH/pkg
ssh://git@github.com/
instead of https://github.com/
ssh://git@github.com/
而不是https://github.com/
go get github.com/company/company-product
go get github.com/company/company-product
the solution which worked for me;对我有用的解决方案;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.