]> Cypherpunks repositories - gostls13.git/commit
cmd/go: simplify/fix handling private github repos
authorIngo Oeser <nightlyone@googlemail.com>
Thu, 29 Jan 2015 14:37:37 +0000 (15:37 +0100)
committerAndrew Gerrand <adg@golang.org>
Fri, 20 Feb 2015 03:21:29 +0000 (03:21 +0000)
commit668762c5709b61e0b442b02c81489a7fdf6f9b19
tree848ca1066d99663fa295f01517e0d3c9050d5c84
parentea1306a150bb3ea465dcfad83c1619d9bab943bd
cmd/go: simplify/fix handling private github repos

Before Go 1.4, the traditional way to work with a private Github
repository was to run something similar the following:

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

It would allow go get and friends to transparently work as expected,
automatically rewriting https URLs to use SSH for auth. This worked both
when pushing and pulling.

In Go 1.4 this broke, now requiring the use of `go get -f` instead of `go get`
in order to fetch private repositories. This seems neither intended nor
practical, as it requires changing a lot of tooling.

So just use `git config remote.origin.url` instead of `git remote -v` as
this reflects the actual substitution intended in the `insteadOf` config
directive.

Also remove now useless parsing.

Also add a check against supported schemes to avoid errors in later
commands using this URL and expecting such a scheme.

Fixes #9697

Change-Id: I907327f83504302288f913a68f8222a5c2d673ee
Reviewed-on: https://go-review.googlesource.com/3504
Reviewed-by: Andrew Gerrand <adg@golang.org>
src/cmd/go/vcs.go