问题
I want to use labgit2sharp to replace the command -- "git pull“ to pull my code from my gitlab. but it is not successful by using the following code:
using (var repo = new Repository(remotePath))
{
LibGit2Sharp.PullOptions options = new LibGit2Sharp.PullOptions();
options.FetchOptions = new FetchOptions();
options.FetchOptions.CredentialsProvider = new CredentialsHandler(
(url, usernameFromUrl, types) =>
new UsernamePasswordCredentials()
{
Username = "username",
Password = "password"
});
repo.Network.Pull(new LibGit2Sharp.Signature("username", emailaddress, new DateTimeOffset(DateTime.Now)), options)
}
Could you help me? I want to know all the steps from the beginning. Thanks very much!
回答1:
Network.Pull is no more used. Please try using LibGit2Sharp.Commands.Pull()
来源:https://stackoverflow.com/questions/36062476/libgit2sharp-replace-the-git-pull-command