diff --git a/src/GitVersionCore/Core/GitPreparer.cs b/src/GitVersionCore/Core/GitPreparer.cs index d2c6c70f47..1ab1a53af3 100644 --- a/src/GitVersionCore/Core/GitPreparer.cs +++ b/src/GitVersionCore/Core/GitPreparer.cs @@ -149,14 +149,14 @@ private void CloneRepository(string repositoryUrl, string gitDirectory, Authenti if (auth != null) { - if (!string.IsNullOrWhiteSpace(auth.Username) && !string.IsNullOrWhiteSpace(auth.Password)) + if (!string.IsNullOrWhiteSpace(auth.Username)) { log.Info($"Setting up credentials using name '{auth.Username}'"); credentials = new UsernamePasswordCredentials { Username = auth.Username, - Password = auth.Password + Password = auth.Password ?? string.Empty }; } } diff --git a/src/GitVersionCore/Extensions/RepositoryExtensions.cs b/src/GitVersionCore/Extensions/RepositoryExtensions.cs index 5fe16e7fc2..c719e34f4a 100644 --- a/src/GitVersionCore/Extensions/RepositoryExtensions.cs +++ b/src/GitVersionCore/Extensions/RepositoryExtensions.cs @@ -196,7 +196,7 @@ private static IEnumerable GetRemoteTipsUsingUsernamePasswordCr return repository.Network.ListReferences(remote, (url, fromUrl, types) => new UsernamePasswordCredentials { Username = username, - Password = password + Password = password ?? string.Empty }).Select(r => r.ResolveToDirectReference()); } diff --git a/src/GitVersionCore/Model/AuthenticationInfo.cs b/src/GitVersionCore/Model/AuthenticationInfo.cs index 83d6fd75f9..d5167d779f 100644 --- a/src/GitVersionCore/Model/AuthenticationInfo.cs +++ b/src/GitVersionCore/Model/AuthenticationInfo.cs @@ -17,7 +17,7 @@ public FetchOptions ToFetchOptions() fetchOptions.CredentialsProvider = (url, user, types) => new UsernamePasswordCredentials { Username = Username, - Password = Password + Password = Password ?? string.Empty }; }