-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/go: custom import path private repos require special configuration #27254
Comments
It works if I just do:
(emphasis on ".git") Then NOTE: I still need to do |
Same error here, import paths like:
Simply don't work and prints:
|
@chowey the reason the Without this (i.e. with an import path like Hence you need to ensure:
For credentials, either you can provide a
or use an OS credential helper (see #26134 (comment)). Also related to #26232. Whether you then use https/ssh access to the underlying VCS is entirely up to you. I think this issue is effectively the custom import path equivalent of #26134. Hence I'm going to retitle it. |
I'm not sure if this is germane to this issue or I should open a new one, but I seem to be able to reproduce this despite checking all of the configuration above:
|
@jackwhelpton are you able to share the output of This might well contain sensitive information in your case, so please be careful. In case you can't share this information publicly, please do say. |
Sure. It does look like an authentication problem, but my standard git commands are working OK. Here's what I get from
|
@jackwhelpton if you run
separately, what is the output? |
Ah, so this may be a git configuration issue, although it's interacting with modules in a strange way (given my ability to
Note that a simple |
@jackwhelpton your Try:
instead of (no pun intended):
|
That does it! Good spot. Should have guessed it would be something idiotic on my side. |
Mine started worked today suddenly without changing anything. I guess some package updated something, added it's modules configuration or whatever... Not sure why I was getting that error though. |
If the domain contains |
For private.repo.net/user/package to work with go get, two things need to happen:
I don't see any indication of what meta tag is being used, exactly. If the meta tag says git:// in the git server URL (instead of https://), then you should not need any special gitconfig. One problem might be the HTTPS fetch needing authentication. That's #26232. Closing this issue assuming it is either a duplicate of #26232 or else solved by using a git:// URL in the meta tag. |
I'm dropping into this after spending a while being extremely frustrated with the modules system. Say I'm developing five different modules at the same time, all hosted on private GitLab. Since I'm developing them at the same time, and often, I want to work on multiple of them without committing changes, why not just use the local directory I already have cloned? A "central" list of locations of all Go modules somewhere in $GOPATH or $GOROOT would suffice. E.g. a file listing a set of "replace" directives, saying |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.11 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOOS="darwin"
What did you do?
I have a private repo served over ssh, using gitolite.
That private repo is a package I want to use, at e.g.
private.repo.net/user/package
. It has a folder structure like this:My global
.gitconfig
looks like this, so thatgo get
works:In my main package
my/package
, I have a go file that imports it like this:This used to work when using the old
$GOPATH
. Now I am trying to use modules instead. I rungo build my/package
which should resolve dependencies and build.What did you expect to see?
I expected it to build.
What did you see instead?
I also tried adding it to the
go.mod
file by runninggo get private.repo.net/user/package.git
. (NOTE: I need to use.git
so that it uses ssh.) So it nowprivate.repo.net/user/package.git
appears in mygo.mod
file.However, when I do
go build
, it still complains that "build my/package: cannot find module for path private.repo.net/user/package/a".The text was updated successfully, but these errors were encountered: