aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/vcs/git.go')
-rw-r--r--pkg/vcs/git.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go
index 5b1efa33a..2f1f0f301 100644
--- a/pkg/vcs/git.go
+++ b/pkg/vcs/git.go
@@ -99,7 +99,10 @@ func (git *git) CheckoutBranch(repo, branch string) (*Commit, error) {
if err := git.repair(); err != nil {
return nil, err
}
- _, err := git.git("fetch", repo, branch)
+ repoHash := hash.String([]byte(repo))
+ // Ignore error as we can double add the same remote and that will fail.
+ git.git("remote", "add", repoHash, repo)
+ _, err := git.git("fetch", repoHash, branch)
if err != nil {
return nil, err
}