-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: go module does not honor a local git override to manage multiple git identities #31256
Comments
We could perhaps do some sort of |
My thinking was that since the module cache contains digital artifacts that are orthogonal to git identity, reusing the same cache under |
@Ravenwater The problem with using the same cache is that it mixes together modules fetched using different credentials, so your builds using the public identity could accidentally depend on (and vendor in the contents of) modules fetched using the private one. On the other hand, if you're ok with mixing those credentials together, why not put them all in your global |
Note that you could always implement your own module proxy server that understands git configurations (see https://tip.golang.org/cmd/go/#hdr-Module_proxy_protocol). For example, such a proxy could change (For all I know, Athens may already do something like that. CC @marwan-at-work for private-repo-proxy ideas.) |
@bcmills on mixing together modules in the same cache creating the condition that the public identity might become dependent on a private module: good point, did not synthesize that inconsistency. That would be a failure mode for sure. So proxy it is. Thank you for your feedback and insights. |
That being the case, I'm going to close out this issue, but please do file new issues if you run into trouble with the proxy approach! |
You can certainly configure Athens to authenticate with your private code host, see here and here. Out of curiosity, if |
@marwan-at-work I don't know enough about the internal workings of git. Git appears to be able to find the root of the repo, as you can issue git commands inside directories in the repo tree and still get the local git identity that is stored at the root. If cmd/go delegates to git the repo operations, your suggestion that running in the CWD context might indeed all that is needed. However, that would still leave @bcmills observation that cross contamination between a private repo and a public program would become possible when both share the same module cache. |
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?
I have two git identities. One for open source contributions, and one for private repo work.
I have a private repo tree, and I use a local
.git/config
override to work as my private repo identity in that tree. Git operations function as expected in this tree. This private repo has go code that refers to modules that are also hosted on this private domain.However,
go build/mod tidy, etc.
use the global git identity, and thus fail to download the dependencies that are in the private repo.What did you expect to see?
I expected
go build
to pick up my local.git/config
override and take on the private repo git identity with the proper redirects to access the private repo.What did you see instead?
Instead, the
go build
tools pick up the global.gitconfig
and use that to access the dependencies. When I replace the global.gitconfig
with my local override that has the right url adapter, thego tools
succeed.The text was updated successfully, but these errors were encountered: