-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go module not forwarding credentials from .netrc to gitlab subgroups #29888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Duplicate of #26232? |
I encounter the same problem: go version go1.11.5 windows/amd64 In the |
No flag should be necessary. Is it possible that your |
I tried out on Windows and on Linux. The |
From what I can see, |
Change https://golang.org/cl/161698 mentions this issue: |
In this case it is important to have .netrc support for the go get since we can clone the git repo using ssh/git credentials but we cannot discover the repo that owns the package without it.
|
Some more information Meta import tag request (...?go-get=1) is done using function go/src/cmd/go/internal/get/vcs.go Lines 855 to 886 in dca707b
Which relies on web.GetMayBeInsecure functiongo/src/cmd/go/internal/web/http.go Lines 76 to 119 in dca707b
This last internally uses the |
Ran into same problem which led me to this github issue. At this point it's a blocker and can't use private gitlab repositories as libraries for other go projects. Any workaround or fix will be greatly appreciated. I see this is tagged to be in Go |
yeah I'm really struggling too - just moved from nodejs to go and this really is a pain point for me aswell (gitlab private nested packages). I kinda just want to pay for npm-like private repos and just have something that works off the bat. |
Same issue here with Go Works with curl $ curl -k -n https://gitlab.com/group/subgroup/myrepo?go-get=1
<html><head><meta name="go-import" content="gitlab.com/group/subgroup/myrepo git https://gitlab.com/group/subgroup/myrepo.git" /></head></html> But when I try Go get it fails $ go get -v gitlab.com/group/subgroup/myrepo
Fetching https://gitlab.com/group/subgroup/myrepo?go-get=1
Parsing meta tags from https://gitlab.com/group/subgroup/myrepo?go-get=1 (status code 200)
get "gitlab.com/group/subgroup/myrepo": found meta tag get.metaImport{Prefix:"gitlab.com/group/subgroup", VCS:"git", RepoRoot:"https://gitlab.com/group/subgroup.git"} at https://gitlab.com/group/subgroup/myrepo?go-get=1
get "gitlab.com/group/subgroup/myrepo": verifying non-authoritative meta tag
Fetching https://gitlab.com/group/subgroup?go-get=1
Parsing meta tags from https://gitlab.com/group/subgroup?go-get=1 (status code 200)
Fetching https://gitlab.com/group/subgroup?go-get=1
Parsing meta tags from https://gitlab.com/group/subgroup?go-get=1 (status code 200)
get "gitlab.com/group/subgroup": found meta tag get.metaImport{Prefix:"gitlab.com/group/subgroup", VCS:"git", RepoRoot:"https://gitlab.com/group/subgroup.git"} at https://gitlab.com/group/subgroup?go-get=1
Fetching https://gitlab.com/group?go-get=1
Parsing meta tags from https://gitlab.com/group?go-get=1 (status code 200)
Fetching https://gitlab.com?go-get=1
Parsing meta tags from https://gitlab.com?go-get=1 (status code 200)
go get gitlab.com/group/subgroup/myrepo: git ls-remote -q https://gitlab.com/group/subgroup.git in /home/alethenorio/go/pkg/mod/cache/vcs/3e751597139208a6e518d0bd38652d0e04d1c2a63f7d667f6fb54374ccef23c7: exit status 128:
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.com/group/subgroup.git/' not found |
This allows `go get` to use netrc files. - Reimplement web.Get as a forwarded call to web2.Get. - Replace secure half of web.GetMaybeInsecure with web2.Get and return the body through it instead of the HTTP response. Related to golang#29888.
Would someone here who has experienced a problem on this issue be willing to open up a problem report on the GitLab side? Maybe it is a case of documentation being incorrect, or maybe there is a bug on the GitLab side, or maybe there is a bug on the |
Its already documented that the issue is The following code comment documents this:
https://gitlab.com/gitlab-org/gitlab-ce/issues/37832 Currently the only robust way I know of is to a) add a system ssh key pair that
this allows the importing (within go) of certainly works, but requires manually updating the go.mod file if you want to change versions or to simply add a new dependency This issue deals specifically with the access of |
The original report here in #29888 (comment) says:
The issue one liner here currently reads "cmd/go: go module not forwarding credentials from .netrc to gitlab subgroups". This issue on the gitlab side was opened a year ago, and is currently closed: The GitLab 11.7 release notes from roughly 2 months ago say:
I was pointed to this particular #29888 issue here by someone who stated roughly that the support for private projects in subgroups released in GitLab 11.7 "doesn't work at all". Part of what I am not following is:
|
|
Thanks for the answers. It seems surprising given what their release notes say. I guess I'll ask again if anyone here is willing or interested in opening up an issue on the GitLab side. It seems they should at least update their documentation or release notes. It might also trigger a GitLab employee to show up here and comment further, which might help advance the resolution for this issue here. (I am not a GitLab user, so I am probably not the best person to open an issue there). |
- Respect the NETRC environment variable if set. - Ignore lines that contain macro definitions. - Associate the 'machine' token with only the tokens that follow (not precede) it. Updates #29888 Updates #26232 Change-Id: I3128b7d6da2d6492df7c864e165eea1a27384f0f Reviewed-on: https://go-review.googlesource.com/c/go/+/161698 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Change https://golang.org/cl/170879 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Last Gitlab release (11.7) enabled go modules downloads for nested groups. It requires authentication for private groups/projects using .netrc file when requesting
?go-get=1
allowing gitlab to understand if the user has the correct access perms for the requested repo.In case of valid credentials and perms the user should get a go import tag with the project that owns the requested repo.
My $HOME/.netrc file:
machine gitlab.mydomain.com login myuser password mysecrettocken
So I was trying to use
go get -v gitlab.mydomain.com/groupA/subGroupB/project/pkg
What did you expect to see?
I expected that
go get
was able to send the http credentials in .netrc and get the repo that owns the imported package and be able to download it.What did you see instead?
go get -v gitlab.mydomain.com/groupA/subGroupB/project/pkg
OutputWhich fails because it didn't find the correct repository in gitlab. Although if I run:
curl -n https://gitlab.mydomain.com/groupA/subGroupB/project/pkg?go-get=1`:
<html><head><meta name="go-import" content="gitlab.mydomain.com/groupA/subGroupB/project git https://gitlab.mydomain.com/groupA/subGroupB/project.git" /></head></html>
Which returns the correct repository path.
As far I can see, go get is not forwarding .netrc credentials when using subgroups.
The text was updated successfully, but these errors were encountered: