libgit2sharp: replace the "git pull” command

末鹿安然 提交于 2019-12-13 02:25:26

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!