New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CloneOptions does not contains a definition of CredentialsProvider,,, #2075
Comments
As mentioned in the change log, there were some breaking changes to
|
from this explanation, it is not clear at all what changes should be made. If you look at FetchOptions now, you won't see anything similar to CredentialsProvider there. Documentation, for example git-clone , immediately became useless.. Great, everything is very clear.... (no) |
The breaking change makes sense to me, but what was the rationale behind making the Do you have any opposition to exposing that either via setter or ctor? I'd be happy to submit a PR. |
I too am utterly confused by this change. Previously, I was creating a CloneOptions and setting CredentialsProvider in there. I can create a FetchOptions instead and set the credentials, but can't find any way to pass this into CloneOptions. Please can someone share a fix? I'm passing in the credentials because the call failed without them. |
@gwsutcliffe Does this work?
|
FetchOptions is read only (see the comment by mburtka above). This is the problem - your solution would be fine if FetchOptions could be set (and I wouldn't be posting here). I've rolled back to v0.28 for now so as not to break my application's functionality. |
Ah, yes, I see, it was changed in November. In that case:
should work, no? (It looks like @mburtka was complaining about not being able to new up a |
That does work, but I had a factory method to new up my customized `FetchOptions' using credentialing defined at startup. To upgrade I have to update that to operate on an existing instance: var cloneOptions = new CloneOptions();
_fetchOptionsManager.Populate(cloneOptions.FetchOptions); Instead of just newing up the |
Right, like I said, I don't have any insight into the rationale here. I don't know if @bording would be willing to review a PR here to change this back to have a setter, or if there's a philosophical or architectural reason to keep it readonly? |
This was an intentional change on my part, primarily around the fact that I wanted to guard against the That was why when I moved |
@bording would you be amenable to having a constructor with either a null guard using the I new up my |
Just creating links for the other issues by people facing the same issue. To set the credentials correctly, see: #2075 (comment) |
Reproduction steps
var cloneOptions = new CloneOptions();
cloneOptions.CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials { Username = credentials.Username, Password = credentials.Password };
Repository.Clone(repository, repofolder, CloneOptions);
Expected behavior
Private repository to get cloned to local hard drive.
Actual behavior
Error message CS1061 'CloneOptions' does not contain a definition for 'CredentialsProvider' and no accessible extension method 'CredentialsProvider' accepting a first argument of type 'CloneOptions' could be found (are you missing a using directive or an assembly reference?)
Version of LibGit2Sharp (release number or SHA1)
0.29.0
Operating system(s) tested; .NET runtime tested
Windows 11, .Net Framework 4.8
The text was updated successfully, but these errors were encountered: