gotip: don't assume origin as the git remote name

When running "gotip download", we try to update the gotip working tree
by running several git commands with the hard-coded name "origin". The
name "origin" is the default in git, but this is configurable, so it's
not necessarily safe to assume that a remote named "origin" will always
exist.

We can, however, force the name "origin" when doing the initial clone,
so that later git operations that interact with the remote can safely
assume that the name "origin" exists. This isn't totally reliable,
because if a user manually renames the remote, the commands that assume
"origin" will still fail. This change, though, ensures that the default
configuration will work even if a user has set clone.defaultRemoteName
in their local git configuration.

Change-Id: I387bac2b8090f7070c1e4833dcc6362bf708c1f6
GitHub-Last-Rev: a7e2ce9ec0b8726dcabac718940e7658e1ff3d61
GitHub-Pull-Request: golang/dl#11
Reviewed-on: https://go-review.googlesource.com/c/dl/+/506696
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Commit-Queue: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/internal/version/gotip.go b/internal/version/gotip.go
index 8132e24..76ce7bb 100644
--- a/internal/version/gotip.go
+++ b/internal/version/gotip.go
@@ -70,7 +70,7 @@
 		if err := os.MkdirAll(root, 0755); err != nil {
 			return fmt.Errorf("failed to create repository: %v", err)
 		}
-		if err := git("clone", "--depth=1", "https://go.googlesource.com/go", root); err != nil {
+		if err := git("clone", "--origin=origin", "--depth=1", "https://go.googlesource.com/go", root); err != nil {
 			return fmt.Errorf("failed to clone git repository: %v", err)
 		}
 	}