go back to using user/pass when cloning from github to avoid prompts for deleted repos

This commit is contained in:
Shawn Smith
2017-12-20 16:31:54 +09:00
parent f9aeaf008e
commit 21e832bd3a

View File

@@ -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
}