libgit2 / libgit2sharp

Git + .NET = ❤
http://libgit2.github.com
MIT License
3.12k stars 878 forks source link

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

Open Rpatil3g opened 1 year ago

Rpatil3g commented 1 year ago

// 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

GeorgeTTD commented 10 months ago

@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.

Kh-Ghassen commented 10 months ago

@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);

GeorgeTTD commented 10 months ago

@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.

Kh-Ghassen commented 10 months ago

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

GeorgeTTD commented 10 months ago

@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.

Kh-Ghassen commented 10 months ago

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