Kshitij Saraogi
Kshitij Saraogi

Reputation: 7629

Installing private Go module: unknown revision error

I have a private Go repo at https://github.com/myorg/myrepo that is used by another Go repo and defined in go.mod.

When I try to run $ go mod tidy to download all the dependencies, it returns me the following error:

go: github.com/myorg/[email protected]: reading github.com/myorg/myrepo/go.mod at revision v0.10.1: unknown revision v0.10.1

The same thing happens when I try to "go get" this module.

What have I tried so far?

I have been stuck with this for a day now and would highly appreciate if someone can suggest me ways to fix this.

Upvotes: 3

Views: 5406

Answers (3)

Senior Pomidor
Senior Pomidor

Reputation: 1915

it almost correct.

git config --global \
  url."https://${GITHUB_TOKEN}@github.com".insteadOf \
  "https://github.com"
go mod download

GITHUB_TOKEN - is the GitHub Personal Access Token

Upvotes: 0

Kshitij Saraogi
Kshitij Saraogi

Reputation: 7629

Finally resolved this thanks to a colleague.

Issue: Local module caching in Go - not sure how its managed internally by the go tool.

Solution:

  1. Delete the ($GOPATH)/pkg/mod/cache repo.
  2. Reinstall the dependencies.

Upvotes: 4

Oleg Butuzov
Oleg Butuzov

Reputation: 5405

try setting all others env vars too.

export GONOSUMDB="github.com/myorg"
export GONOPROXY="github.com/myorg"
export GOPRIVATE="github.com/myorg"

Upvotes: 0

Related Questions