Navigation Menu

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: get should fall back to the git protocol #18927

Closed
willfaught opened this issue Feb 3, 2017 · 9 comments
Closed

cmd/go: get should fall back to the git protocol #18927

willfaught opened this issue Feb 3, 2017 · 9 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@willfaught
Copy link
Contributor

go get doesn't work for private GitHub repos because it only tries HTTPS (or HTTP if you use -insecure IIUC). Why not have a fallback for HTTPS that tries SSH as well?

@rakyll rakyll added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Feb 6, 2017
@rakyll rakyll added this to the Go1.9 milestone Feb 6, 2017
@rakyll
Copy link
Contributor

rakyll commented Feb 6, 2017

AFAIK, URL rewrite via a git config is working for others but we need a more reliable solution for this case. It is a large majority of the users who has to maintain private packages and go get doesn't support such a common case out of the box.

URL rewrite config:

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

@rakyll rakyll changed the title cmd/go: why doesn't it fall back to the git: protocol? cmd/go: get should fall back to the git protocol Feb 6, 2017
@willfaught
Copy link
Contributor Author

willfaught commented Feb 6, 2017 via email

@johansglock
Copy link

I feel this is more a documentation issue rather then a problem that needs solving, I'm perfectly happy using .netrc authentication for example:
https://gist.github.com/cactus/3925422

In the case of git there seem to be plenty more solutions (which I haven't tested):
https://git-scm.com/docs/gitcredentials

Go uses different VCS and so far as I know has chosen to use HTTP(S) as it's common transport protocol. For me it would make more sense to document how each VCS would be properly configured for authentication since in the end it should be the responsibility of the VCS to authenticate.

Adding SSH as an extra transport protocol seems unnecessary complicated to combine with canonical imports and any other potential edge cases.

@willfaught
Copy link
Contributor Author

It uses http/s because they're most commonly left open in firewalls (from the Go FAQ, if I recall correctly). SSH is yet another common transport that any VCS could use; how they use it, I shouldn't have to care about; it should work out of the box. If I have to configure a VCS to use SSH, then in general I have to know what VCS a package is hosted with before I try to import it.

@rsc rsc modified the milestones: Go1.10, Go1.9 Jun 12, 2017
@rsc
Copy link
Contributor

rsc commented Jun 26, 2017

I think private Github repos work with HTTPS. The assertion above is that they only work over SSH. Can someone clarify?

@johansglock
Copy link

They work over HTTPS by provisioning a .netrc config for example.

@willfaught
Copy link
Contributor Author

@rsc If private GitHub repos did work with HTTPS, then wouldn't the Go FAQ explain how to do that instead of how to do the Git URL rewrite configuration?

@rsc rsc modified the milestones: Go1.10, Go1.11 Dec 1, 2017
@gopherbot
Copy link

Change https://golang.org/cl/107775 mentions this issue: doc: update "go get" HTTPS answer to mention .netrc

@rsc
Copy link
Contributor

rsc commented Apr 18, 2018

I sent out a doc update in response to the comment above, and then we'll call this fixed.

golang.org/cl/107775.

@rsc rsc added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Apr 18, 2018
@golang golang locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants