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: private Github repos still require -f to update #10791

Closed
christophercurrie opened this issue May 12, 2015 · 8 comments
Closed

cmd/go: private Github repos still require -f to update #10791

christophercurrie opened this issue May 12, 2015 · 8 comments
Milestone

Comments

@christophercurrie
Copy link

As reported in #9697, the pre-1.4 way to work with private repositories was to add configuration to ask Git to rewrite the URLs being generated by go get:

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

The initial fix for this issue in 668762c works fine for initially checking out a repository, but the fix is incomplete. go get continues to fail when updating a repository:

$ go get -u github.com/tools/godep
$ go get -u github.com/tools/godep
package github.com/tools/godep: github.com/tools/godep is a custom import path for https://github.com/tools/godep, but /Users/codemonkey/Projects/gopath/src/github.com/tools/godep is checked out from git@github.com:tools/godep

The workaround for this is to specify -f to go get; as was noted in the prior ticket, updating scripting to specify this flag everywhere is possible but irritating.

@minux minux changed the title Private Github repos still require -f to update cmd/go: private Github repos still require -f to update May 12, 2015
@minux minux added this to the Go1.5 milestone May 12, 2015
@syst3mw0rm
Copy link
Contributor

Well, I don't see any issue here. I tried the commands you mentioned and it seems to work fine for me. I also tried with private repo of my own with no issue at all.

I think the reason why you are facing problem is perhaps because you did go get before the parent issue (#9697) was resolved. Can you confirm if that is the case? Can you try it with another repo which is not already in your workspace?

@christophercurrie
Copy link
Author

I can reproduce this using the godep repo in a clean workspace:

$ go version
go version go1.4.2 darwin/amd64
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ mkdir gosrc
$ export GOPATH=`pwd`/gosrc
$ go get -u github.com/tools/godep
$ ls gosrc/bin/
godep
$ go get -u github.com/tools/godep
package github.com/tools/godep: github.com/tools/godep is a custom import path for https://github.com/tools/godep, but /Users/codemonkey/Projects/gosrc/src/github.com/tools/godep is checked out from git@github.com:tools/godep

@syst3mw0rm
Copy link
Contributor

I see, you are using the buggy code. The fix (https://go-review.googlesource.com/#/c/3504/) for parent issue (#9697) was merged on Feb20. While go1.4.2 was released on Feb18. It seems go1.4.2 does not include the fix.

I tried with master branch - go version devel +71bf182 and faced no such issue. I also tried with go1.4 and was able to reproduce.

@christophercurrie
Copy link
Author

I see; we're unlikely to introduce the development version into our build. Is there a plan for a 1.4.3 release?

@syst3mw0rm
Copy link
Contributor

I am not sure about that, maybe someone from core contributors can comment about it.

@ianlancetaylor
Copy link
Contributor

There are no current plans for a 1.4.3 release. If there were, it's quite unlikely that this would be included. In minor releases we only fix critical bugs with no workarounds. This bug has a workaround: use -f.

Do I understand correctly that this bug is fixed on tip?

@syst3mw0rm
Copy link
Contributor

Yes, it is fixed on tip.

@ansel1
Copy link

ansel1 commented Aug 10, 2015

As a workaround, if you rename the remote from "origin" to something else, it starts working shrug.

So, given the example in the description, this seems to fix it:

$ cd $GOPATH/src/github.com/tools/godep
$ git remote rename origin github
$ go get -u

@golang golang locked and limited conversation to collaborators Aug 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants