Skip to content
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: prioritize local git config over global git config #46889

Closed
johnrichardrinehart opened this issue Jun 23, 2021 · 4 comments
Closed

cmd/go: prioritize local git config over global git config #46889

johnrichardrinehart opened this issue Jun 23, 2021 · 4 comments
Labels
FeatureRequest FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.

Comments

@johnrichardrinehart
Copy link

johnrichardrinehart commented Jun 23, 2021

go get for private repos can configured to use git:// protocol repo fetches instead of https:// if git is configured at the global level as follows:

git config --global url."git@github.com:".insteadOf "https://github.com/"

as seen in https://gist.github.com/dmitshur/6927554

However, this only seems to work with --global. I only want to change this behavior on a per-repository basis, prioritizing .git/config (local) over ~/.gitconfig or ~/.config/git/config (global). There seems to have been another issue related to this that was frozen and closed due to inactivity: #19127

Is there a good reason not to support this?

@ALTree ALTree changed the title Prioritize local git config over global git config cmd/go: prioritize local git config over global git config Jun 23, 2021
@ALTree ALTree added FeatureRequest NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Jun 23, 2021
@seankhliao
Copy link
Member

Assuming module mode, if you look at what go does (use -x), it calls git from the context of the destination module cache directories not the local workspace, meaning to support this it would have to mess with git configs.
And since the module cache is shared for the whole machine it doesn't really make sense to do it per local workspace?

@bcmills
Copy link
Contributor

bcmills commented Jun 23, 2021

The Go module cache stores dependencies shared among all modules. Applying local git settings would potentially pollute the global cache with local credentials. (See previously #31256.)

@bcmills
Copy link
Contributor

bcmills commented Jun 23, 2021

Duplicate of #31256

@bcmills bcmills marked this as a duplicate of #31256 Jun 23, 2021
@bcmills bcmills closed this as completed Jun 23, 2021
@johnrichardrinehart
Copy link
Author

Okay, that makes sense. Sorry I didn't see #31256. Thanks for linking it!

@golang golang locked and limited conversation to collaborators Jun 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants