I'm trying to get a specific package from github for a project.
However, when I use go get [url]
or go mod vendor
, I get a git fetch error for lack of permissions to one of my company's repos. This repo is vendored, which is how we get around it for go test, go build etc.
This is the error message:
go: private.work.repo.com/project/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in C:\Users\NICHOLAS.TAN\go\pkg\mod\cache\vcs\37594aeb10b98234e04b4780cf59f32c4ad7bb9da460f552103ae748cea73aa1: exit status 128:
fatal: remote error: Repository not found
The requested repository does not exist, or you do not have permission to
access it.
Is there a way for me to use go get
and/or go mod vendor
without those commands trying to look at the other module dependencies?
You can get specific version of package use
go get <package>@<version>
in your project directory, for example:Go download only
get github.com/golang/protobuf
package required version to local cache ($GOPATH/pkg/mod
) and set version togo.mod
file.After all, if you have dependencies from your company's repos in local cache (
$GOPATH/pkg/mod
), usego mod vendor
to createvendor
(Go get ones from cache).