gitlab privilege issue when running go mod tidy on Windows 11

Ranjit

I am able to do clone, push and other git commands very well (must be stored in credential manager in windows). But issue appear when I execute go mod tidy

Below is the error I got when executing go mod tidy on my windows machine. Looks like no access to private repository.

gitlab.xxxxx.de/cxxxxs-v2/arc-lib/cxxxxs-go-lib/pkg/clients:
gitlab.xxxx.de/cxxxxs-v2/arc-lib/[email protected]: verifying
module: gitlab.xxxx.de/cxxxxs-v2/arc-lib/[email protected]:
reading
https://sum.golang.org/lookup/gitlab.xxxxx.de/cxxxxs-v2/arc-lib/[email protected]:
404 Not Found
    server response:
    not found: gitlab.xxxxx.de/cxxxxs-v2/arc-lib/[email protected]: invalid
version: git ls-remote -q origin in
/tmp/gopath/pkg/mod/cache/vcs/387e08be1426cc3d2399d471d4c4b55445c31d6ca639398a03889c4c3282d1d5:
exit status 128:
            fatal: could not read Username for 'https://gitlab.xxxxx.de': 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 have created the HOME env variables, pointing to same folder as USERPROFILE.

Also created _netrc file with machine, username and password. Same username and password used in web gitlab login, it works fine.

_netrc content :

machine gitlab.aaaaaa.de
login ranjit.kumar
password *****

I am not able to figure out how to debug this to find rootcause and hence the solution. Please guide me on this.

Zeke Lu

reading https://sum.golang.org/lookup/gitlab.xxxxx.de/cidaas-v2/arc-lib/[email protected]: 404 Not Found

It tries to lookup your private module in the Go SUMDB. Since your module is private, it's not there.

You should add the glob pattern of your private module to GOPRIVATE. Do it like this:

go env -w GOPRIVATE=gitlab.xxxxx.de

GOPRIVATE acts as a default value for GONOPROXY and GONOSUMDB. It tells the go tool to download the module from the private repository directly (GONOPROXY) and not to check the module using the public checksum database (GONOSUMDB).

See Private modules for more information.


BTW, you don't need to set _netrc if you can fetch or push to the repository without it. And setting the HOME environment variable seems irrelevant too.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related