I have a private project which uses a private module at github.com/company/company-product
. When I try to build the project, I get:
go: github.com/company/[email protected]: reading github.com/company/company-product/go.mod at revision v1.0.4: unknown revision v1.0.4
Things I have tried:
- Checked that the tag exists
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/*
- Configured git to use
ssh://[email protected]/
instead ofhttps://github.com/
- Configured git to use
ssh://[email protected]/
instead ofhttps://github.com/
- Deleted everything in
$GOPATH/pkg
go clean
go mod download
,go mod tidy
,go mod vendor
(which all produce the above error)- Restarted my computer
- Connected to my company's VPN
And yet I still get the same error.
CodePudding user response:
It looks like the key was to do things in a certain order:
- Reinstall Go
- Set environment variables GOPRIVATE, GONOPROSXY, GONOSUMDB to
github.com/company/*
- Remove the folder
$GOPATH/pkg
- Setup Git to use
ssh://[email protected]/
instead ofhttps://github.com/
- Run
go get github.com/company/company-product
CodePudding user response:
the solution which worked for me;
- go env -w GOPRIVATE=github.com/company
- git config --global url."https://username:[email protected]".insteadOf "https://github.com"
- env GIT_TERMINAL_PROMPT=1 go get github.com/company/privaterepo