Skip to content

Commit f2652f3

Browse files
committed
gitlab: support GCM_ALLOW_UNSAFE_REMOTES option
1 parent 6b87cc7 commit f2652f3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/shared/GitLab/GitLabHostProvider.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,13 @@ public override async Task<ICredential> GenerateCredentialAsync(InputArguments i
9595
ThrowIfDisposed();
9696

9797
// We should not allow unencrypted communication and should inform the user
98-
if (StringComparer.OrdinalIgnoreCase.Equals(input.Protocol, "http"))
98+
if (!Context.Settings.AllowUnsafeRemotes &&
99+
StringComparer.OrdinalIgnoreCase.Equals(input.Protocol, "http"))
99100
{
100101
throw new Trace2Exception(Context.Trace2,
101-
"Unencrypted HTTP is not supported for GitHub. Ensure the repository remote URL is using HTTPS.");
102+
"Unencrypted HTTP is not recommended for GitLab. " +
103+
"Ensure the repository remote URL is using HTTPS " +
104+
$"or see {Constants.HelpUrls.GcmUnsafeRemotes} about how to allow unsafe remotes.");
102105
}
103106

104107
Uri remoteUri = input.GetRemoteUri();

0 commit comments

Comments
 (0)