diff --git a/app/react/portainer/gitops/queries/useCheckRepo.ts b/app/react/portainer/gitops/queries/useCheckRepo.ts index 9a64bb1ae..3486c03b2 100644 --- a/app/react/portainer/gitops/queries/useCheckRepo.ts +++ b/app/react/portainer/gitops/queries/useCheckRepo.ts @@ -51,7 +51,7 @@ export async function checkRepo( const { creds = {} } = options; // If no credentials were provided alter error from git to indicate repository is not found or is private if ( - !(creds.username && creds.password) && + (!(creds.username && creds.password) || !creds.gitCredentialId) && details === 'authentication failed, please ensure that the git credentials are correct' ) { diff --git a/app/react/portainer/gitops/utils.ts b/app/react/portainer/gitops/utils.ts index 2b5157890..654dd1755 100644 --- a/app/react/portainer/gitops/utils.ts +++ b/app/react/portainer/gitops/utils.ts @@ -11,6 +11,10 @@ export function getAuthentication( | 'RepositoryGitCredentialID' > ) { + if (!model.RepositoryAuthentication) { + return undefined; + } + if (model.RepositoryGitCredentialID) { return { gitCredentialId: model.RepositoryGitCredentialID }; } diff --git a/go.work.sum b/go.work.sum index 4a34d0613..b5e028f6d 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,2 +1,3 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=