문제

I'm looking for a nice clean example of how to do a pull using lidgit2sharp. I took the example here which does a fetch, but the reference to Credentials is throwing an exception.

using (var repo = new Repository(workingDir, null))
{
    Remote remote = repo.Network.Remotes.Add("master", repoUrl);
    repo.Network.Fetch(remote, 
    {    
        Credentials credentials = new Credentials
        {
            Username = "username",
            Password = "password"
        }
    });
}

The exception is Cannot create an instance of the abstract class or interface 'LibGit2Sharp.Credentials'

도움이 되었습니까?

해결책

It's telling you in the error: Credentials is an abstract class, interface, whatever.

Try this:

Credentials credentials = new UsernamePasswordCredentials()
{

        Username = "username",
        Password = "password"
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top