diff --git a/pkg/git/git.go b/pkg/git/git.go index 98f9020a0a6..540df6b53e9 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -26,6 +26,7 @@ import ( "strings" homedir "github.com/mitchellh/go-homedir" + "github.com/tektoncd/pipeline/pkg/apis/pipeline" "go.uber.org/zap" ) @@ -261,9 +262,8 @@ func userHasKnownHostsFile(logger *zap.SugaredLogger) (bool, error) { } func validateGitAuth(logger *zap.SugaredLogger, url string) { - homeenv := os.Getenv("HOME") sshCred := true - if _, err := os.Stat(homeenv + "/.ssh"); os.IsNotExist(err) { + if _, err := os.Stat(pipeline.CredsDir + "/.ssh"); os.IsNotExist(err) { sshCred = false } urlSSHFormat := ValidateGitSSHURLFormat(url)