Skip to content

Commit

Permalink
Merge pull request #60 from davidkl97/fix/default-fallback-git-creden…
Browse files Browse the repository at this point in the history
…tials

fix(git): fallback to git credentials if explict env not found
  • Loading branch information
itamar-marom authored Feb 21, 2024
2 parents 9e94621 + d20b017 commit 5fd8fb8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/services/drivers/version_control/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 5fd8fb8

Please sign in to comment.