From d20b0172d033bec2fe3cc943142d74f01f0f4f86 Mon Sep 17 00:00:00 2001 From: "david.klinberg" Date: Wed, 21 Feb 2024 16:39:38 +0200 Subject: [PATCH] fix(git): fallback to git credentials if explict env not found --- internal/services/drivers/version_control/git.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/services/drivers/version_control/git.go b/internal/services/drivers/version_control/git.go index f555e3f..ce0157e 100644 --- a/internal/services/drivers/version_control/git.go +++ b/internal/services/drivers/version_control/git.go @@ -158,7 +158,10 @@ func (g *Git) cleanTemp(modulesSourcePath string) error { func (g *Git) getGitCredentials(url string, externalGit bool) (userName string, password string, err error) { if !externalGit { userName, password = g.getGitUserNameAndToken(url) - return userName, password, nil + if userName != "" && password != "" { + return userName, password, nil + } + g.log.Warnf("credentials not found from env variables. falling back to git credentials") } // Required until https://github.com/go-git/go-git/issues/490 addressed ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(GitCredentialDeadLineMs*time.Millisecond))