From ba34a6d4016996b8344ddf6d0bb6139bfc36f94f Mon Sep 17 00:00:00 2001
From: Stefan Prodan <stefan.prodan@gmail.com>
Date: Thu, 12 Nov 2020 09:47:04 +0200
Subject: [PATCH] Fix GitHub bootstrap with token auth

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
---
 cmd/flux/bootstrap_github.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cmd/flux/bootstrap_github.go b/cmd/flux/bootstrap_github.go
index 0fd0a1aa..a17837d4 100644
--- a/cmd/flux/bootstrap_github.go
+++ b/cmd/flux/bootstrap_github.go
@@ -212,6 +212,8 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
 		logger.Successf("install completed")
 	}
 
+	repoURL := repository.GetURL()
+
 	if bootstrapTokenAuth {
 		// setup HTTPS token auth
 		secret := corev1.Secret{
@@ -229,6 +231,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
 		}
 	} else {
 		// setup SSH deploy key
+		repoURL = repository.GetSSH()
 		if shouldCreateDeployKey(ctx, kubeClient, namespace) {
 			logger.Actionf("configuring deploy key")
 			u, err := url.Parse(repository.GetSSH())
@@ -256,7 +259,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
 
 	// configure repo synchronization
 	logger.Actionf("generating sync manifests")
-	if err := generateSyncManifests(repository.GetSSH(), bootstrapBranch, namespace, namespace, ghPath, tmpDir, ghInterval); err != nil {
+	if err := generateSyncManifests(repoURL, bootstrapBranch, namespace, namespace, ghPath, tmpDir, ghInterval); err != nil {
 		return err
 	}
 
-- 
GitLab