From 21e832bd3aa975905391c97b5bcc7f0e20eac676 Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Wed, 20 Dec 2017 16:31:54 +0900 Subject: [PATCH] go back to using user/pass when cloning from github to avoid prompts for deleted repos --- download/download.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/download/download.go b/download/download.go index fa8d01f..7dcd9a6 100644 --- a/download/download.go +++ b/download/download.go @@ -3,6 +3,7 @@ package download import ( "errors" "log" + "net/url" "os" "path/filepath" "strings" @@ -63,7 +64,17 @@ func download(path, dest string, firstAttempt bool) (root *vcs.RepoRoot, err err if root.VCS.Name == "Git" { root.VCS.CreateCmd = "clone --depth 1 {repo} {dir}" } - err = root.VCS.Create(fullLocalPath, root.Repo) + var rootRepo = root.Repo + u, err := url.Parse(root.Repo) + if err != nil { + log.Printf("WARN: could not parse root.Repo: %v", err) + } else { + if u.Host == "github.com" { + u.User = url.UserPassword("gojp", "gojp") + rootRepo = u.String() + } + } + err = root.VCS.Create(fullLocalPath, rootRepo) if err != nil { return root, err }