libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

LibGit2Sharp.LibGit2SharpException: failed to parse supported auth schemes: The operation identifier is not valid

Open Rpatil3g opened this issue 2 years ago • 6 comments

// code start LibGit2Sharp.PullOptions options = new LibGit2Sharp.PullOptions(); options.FetchOptions = new FetchOptions(); options.FetchOptions.CredentialsProvider = new CredentialsHandler( (url, usernameFromUrl, types) => new UsernamePasswordCredentials() { Username = _gitCredsUser, Password = _gitCredsPassword });

        // User information to create a merge commit
        var signature = new LibGit2Sharp.Signature(
            new Identity(_gitUsername, _gitEmail), DateTimeOffset.Now);

        // Pull
        Commands.Pull(repo, signature, options);

// end code

I am using LibGit2Sharp dll of 0.26.0.0, from last few days I am getting "failed to parse supported auth scheme" error while doing git pull. My git repository is on GITHUB. I am sure there might security related changes done on github side. that's why this error come.

Reproduction steps

Expected behavior

git pull should work without error.

Actual behavior

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

windows 10

Rpatil3g avatar Jul 07 '23 10:07 Rpatil3g

@Rpatil3g did you mange to get around this issue? I think its definitely a breaking change in GitHub as had similar issues with GitKraken too with the same error message.

GeorgeTTD avatar Aug 16 '23 15:08 GeorgeTTD

@Rpatil3g @GeorgeTTD did anyone of you manage to get around this issue ? i'm having the same with LibGit2Sharp 0.27.2 Her is exactly when it occurs :

System.IO.Directory.CreateDirectory(dirPath); var cloneOptions = new LibGit2Sharp.CloneOptions { CredentialsProvider = (_url, _user, _cred) => new LibGit2Sharp.UsernamePasswordCredentials { Username = AccessToken, Password = string.Empty }, BranchName = Branch, }; LibGit2Sharp.Repository.Clone(cloneUrl, dirPath, cloneOptions);

Kh-Ghassen avatar Aug 31 '23 09:08 Kh-Ghassen

@Kh-Ghassen there is apparently a workaround but its a bit low level for us as we don't have the C skills to diagnose the issue. so we have chosen to remove the dependency from our source.

GeorgeTTD avatar Aug 31 '23 09:08 GeorgeTTD

Thanks @GeorgeTTD , can i ask you what did you choose for replacement ?

Kh-Ghassen avatar Aug 31 '23 09:08 Kh-Ghassen

@Kh-Ghassen our use case is very limited so may not work for yours but we have gone with calling command line git inspired by this repo: https://github.com/WonkySpecs/GitWrapper/blob/master/Git.cs

As a side note we also use GitKraken that use libgit2 and I was having the same issue with their product. When I spoke to their support they said they are removing libgit2 and using command line git instead, I assume in a similar way.

GeorgeTTD avatar Aug 31 '23 09:08 GeorgeTTD

@GeorgeTTD Cool , thank you very much , i think we'll try to go with command line also

Kh-Ghassen avatar Aug 31 '23 09:08 Kh-Ghassen