-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go get doesn't work with private gitbucket repo #19766
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
See gitbucket is not a hosted service, right? So we couldn't regexp it anyway, since users can run it on any hostname? So I think the best option is for you to modify gitbucket to add the right Let me know if I misunderstand, but I think there's nothing for us to do here so I'm going to close this. Holler if I should reopen. |
I think the essence of the problem occurs when we use a git repo not in your list of public servers, we default to the regex found at line 902 in: https://golang.org/src/cmd/go/vcs.go This regex creates the following problem as I understand it: For any git repository, if you go get domain.of.repo/repo/name.git, go tries to clone domain.of.repo/repo/name instead of name.git. IOW, the belief by our devs is that this is incorrect behavior for the default case. As an aside - I see more and more customers spinning up their own repos on their own hosts wherein this default behavior might come back to bite them. P.S. We also believe there is an issue with GitBucket itself here as well: If you try to import domain.of.repo/repo/name/deep/import, go tries to http get domain.of.repo/repo/name/deep/import, which 404s, because gitbucket serves that path at domain.of.repo/repo/name/tree/master/deep/import. Thanks for the quick turnaround here! |
What is your concrete problem? And you didn't reply to my suggestion of using the Go |
(And by concrete problem, I mean to give me an actual command go get command that fails.) |
I have contacted the devs involved and asked for more specific details. |
Hey Brad, Here's the issue that I'm seeing:
Please note that From what I can tell, the default vcsPath is being matched, and the regexp is stripping the '.git' from the vcs repo. (At line 902 in vcs.go) |
What does:
... say? |
That returns the same references that are returned by git ls-remote ssh://... |
If your Git server is not one of the recognized ones (say, Github) and not pointed at by a custom domain using tags, then the final fallback is that we'll recognize x.git/y as meaning checkout x with git and then look at y inside the repo. Note that some Git servers (like Github) make the .git optional so that x and x.git mean the same thing, which can be a source of confusion here, but the .git in this syntax is so go get knows to use git at all, not sent to the server. Otherwise it would not be possible to use a repo that didn't end in .git. If on your server x needs to end in .git, you need to say it twice, once for your server and once for go get:
Of course that looks awful but it's implied by the use of this fallback. In general it's far preferable to set up an HTTPS redirector to let you separate the import paths from the exact location of the git servers (for example The fallback here predates the custom URLs. If I had it to do again I'd probably just remove the fallback entirely and require HTTPS tags. |
Hi @bradfitz @rsc , could we add a configure to add our own git servers like the public serves in code(https://golang.org/src/cmd/go/vcs.go)? Then |
#27344 appears to be a duplicate of this issue. The steps to reproduce the error there are easier for me to follow, so I'm going to consolidate the issue there. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?x64 RHEL7
What did you do?
Attempt to do a deep import (go get) on private gitbucket repo
What did you expect to see?
Correct import
What did you see instead?
Fails because clone URL is not getting correctly parsed from gitbucket
I am doing devops support for a client doing a bunch of new go stuff. They are using an internal instance of gitbucket for their corporate code. I am not a go expert by any means, but as I understand it ....
One of the devs showed me the list of rexeges baked into go for the various vcs products out there, but gitbucket seems not to be on there as best as I could tell.
So ... I guess the ask is either:
Any thoughts here would be welcome.
The text was updated successfully, but these errors were encountered: