Skip to content

Commit 6c7814f

Browse files
author
Yannis Guedel
committed
Fixed libgit2 bug/deprecated
In libgit2 the "Credentials" property is deprecated, instead CredentialsHelper should be used. In 0.19 there is a bug with the Credentials property when cloning, using the "correct" way (CredentialsHelper) fixes the bug: libgit2/libgit2sharp#834 In order to be consistent I changed also the fetch method.
1 parent 3474397 commit 6c7814f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

GitVersionCore/BuildServers/GitHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static FetchOptions BuildFetchOptions(string username, string password)
101101

102102
if (!string.IsNullOrEmpty(username))
103103
{
104-
fetchOptions.Credentials = new UsernamePasswordCredentials
104+
fetchOptions.CredentialsProvider = (url, user, types) => new UsernamePasswordCredentials
105105
{
106106
Username = username,
107107
Password = password

GitVersionExe/GitPreparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ string GetGitInfoFromUrl()
5757
Logger.WriteInfo(string.Format("Retrieving git info from url '{0}'", arguments.TargetUrl));
5858

5959
Repository.Clone(arguments.TargetUrl, gitDirectory,
60-
new CloneOptions { IsBare = true, Checkout = false, Credentials = credentials});
60+
new CloneOptions { IsBare = true, Checkout = false, CredentialsProvider = (url, user, types) => credentials });
6161

6262
if (!string.IsNullOrWhiteSpace(arguments.TargetBranch))
6363
{

0 commit comments

Comments
 (0)