user1532587
user1532587

Reputation: 1023

Cannot install a replaced go package due to verification error

I'm truing to install tensorflow by replacing it with a private repo. It wont install since it says it cant read user details for my private gitlab. I've replaced https by ssh in git config and also tried enabling command prompt. Looks like the verification step fails.

go mod download github.com/tensorflow/tensorflow
go: git.myrepos.com/team/[email protected]: verifying go.mod: git.myrepos.com/team/[email protected]/go.mod: reading https://sum.golang.org/lookup/git.myrepos.com/team/[email protected]: 410 Gone
    server response:
    not found: git.myrepos.com/team/[email protected]: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/2658c7dea94643a56da034a91ab984d322bf101412d6039a91e73001beedffd2: exit status 128:
        fatal: could not read Username for 'https://git.myrepos.com': terminal prompts disabled
    Confirm the import path was entered correctly.
    If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

And my go.mod

go 1.18


replace (
    github.com/tensorflow/tensorflow => git.myrepos.com/team/tensorflow v1.0.0
)

require (
    github.com/tensorflow/tensorflow v0.0.0-00010101000000-000000000000
)

Here's my .gitconfig

➜  tensorflow cat /Users/myuser/.gitconfig
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
    name = myuser
    email = [email protected]
[url "ssh://[email protected]/"]
    insteadOf = https://git.myrepos.com/
[core]
    editor = nano
[url "[email protected]:"]
    insteadOf = https://gitlab.com/
    insteadOf = https://gitlab.com/

I've also tried this:

export GIT_TERMINAL_PROMPT=1
env GIT_TERMINAL_PROMPT=1 go get github.com/tensorflow/tensorflow/tensorflow/go

Update:

GIT_TERMINAL_PROMPT=1 GIT_TRACE=1 GIT_CURL_VERBOSE=1 go get github.com/tensorflow/tensorflow/tensorflow/go 

go: github.com/tensorflow/[email protected] (replaced by git.myrepo.com/team/[email protected]): verifying go.mod: git.myrepo.com/team/[email protected]/go.mod: reading https://sum.golang.org/lookup/git.myrepo.com/team/[email protected]: 410 Gone
    server response:
    not found: git.myrepo.com/team/[email protected]: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/2658c7dea94643a56da034a91ab984d322bf101412d6039a91e73001beedffd2: exit status 128:
        fatal: could not read Username for 'https://git.myrepo.com': terminal prompts disabled
    Confirm the import path was entered correctly.
    If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

To add more context. Looks like the output is the output of https://sum.golang.org/lookup/git.myrepo.com/tream/[email protected]:

Notice that I replaced the true URL for privacy purposes

not found: git.myrepo.com/team/[email protected]: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/2658c7dea94643a56da034a91ab984d322bf101412d6039a91e73001beedffd2: exit status 128:
    fatal: could not read Username for 'https://git.myrepo.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

I dont understand why it tries to verify my package or how to avoid that. Clearly only I have access to it

Upvotes: 3

Views: 5595

Answers (2)

omer blechman
omer blechman

Reputation: 386

Solved it by:

  • Verify GOPRIVATE is well defined: go env -w GOPRIVATE="<private_repo>/*"
  • Verify private repo is well defined at .gitconfig
  • remove the problematic cache: rm -rf /tmp/gopath/pkg/mod/cache/vcs/2658c7dea94643a56da034a91ab984d322bf101412d6039a91e73001beedffd2

Upvotes: 1

user1532587
user1532587

Reputation: 1023

Solved by exporting this env var:

GOPRIVATE=git.myrepo.com/team

From go doc https://pkg.go.dev/cmd/go#hdr-Configuration_for_downloading_non_public_code

Upvotes: 2

Related Questions