-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go get [email protected] instead of https:// #6968
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
you can add the following two lines to ~/.gitconfig to work around this problem: [url "[email protected]:"] insteadOf = https://github.com/ |
There's an app for fixing the remote: https://github.com/nf/remotefix/blob/master/main.go |
You could do a HEAD request of the URL. If it comes back as 200 OK it's public, and if it's 404 it's private. When trying to `go get` a non-existent repo it creates the directory anyway. Github also has an REST API that could be used: http://developer.github.com/v3/repos/#get Another option is to just have an environmental variable that toggles the behavior of go get for all github.com repos, regardless if they're public or private. Downside of that is having to enter your private key password for public repos, but you only have to do that once every so often. |
Comment 8 by [email protected]: I have to agree that an -ssh flag sounds great, since 'git clone' doesn't entirely replace 'go get'. |
I would like to reopen this bug after the transfer from https://code.google.com/p/go/issues/detail?id=6968 I believe that the comments have not been fully addressed, and although appreciating the developers' work, the "it's not a bug, it's a feature" answer does not fully resolve the issue at hand. This is a serious limitation of the usefulness of 'go get' especially when non-devs need to update go dependencies and when devs need to use enterprise github. |
This should perhaps be discussed on golang-dev. |
Having trouble finding this discussion on golang-dev. Does anyone have a link to the thread? |
Agree that 'working as intended' is not really an answer. |
+1 to doing something better here. I don't think "WorkingAsIntended" is fair. |
Is there a reason it wants to assume https:// and not allow [email protected]... This makes it hard to use private or writable repos (you can't use ssh keys) and are forced to (http) authenticate on every access. If there were an option to override this error/setting for Is anyone on the go team using private repos? Seems like a very common use case that a lot of people are struggling with. |
Closed? :_( |
cmd/go uses https:// by default because that's what github recommends: https://help.github.com/articles/which-remote-url-should-i-use/ To avoid needing to reauthenticate for every access, you can setup a Git credential helper: https://help.github.com/articles/caching-your-github-password-in-git/ If you need/want to use [email protected] instead of https://, then see Minux's initial response on the issue: #6968 (comment) |
Oh awesome, thanks for pointing to the git credential helper, that works. BTW, if you do minux's suggestion you still get an error. It might have On Mon, Apr 13, 2015 at 12:26 PM, Matthew Dempsky [email protected]
|
I don't think so. I just verified, and Minux's suggestion works fine for me with Git 2.2 on Ubuntu 14.04. I also regularly use similar insteadOf configs to work with Go code in private (non-GitHub) Git repos. You can also try running:
instead of manually editing your .gitconfig file. If that still doesn't work for you, I suggest following up with the Git developers. |
Hi, I ended up doing this, which is to use SSH for my company's repositories.
Thanks guys. |
Although the workaround exists, I think I and a lot of people here would appreciate to have it supported officially. Also adding a flag to a command is simpler than editing a gitconfig file in various deployment scenarios. |
Adding a flag increases complexity, documentation requirements, and mental overhead trying to read the docs. We try really hard to avoid flags, options, and complexity.
You should not be using |
What would you use in that case? Just wondering :) |
Let's move discussion to golang-nuts@. This isn't for a bug tracker. |
Can you provide links to the discussions on golang-nuts or golang-dev? |
The text was updated successfully, but these errors were encountered: