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!
remotePath
? This has to be a local file path, not your remote Git source. Also post the error/stack trace that you are getting. – Kilbridelibgit2
librarygit2-785d8c4
is not being found, have you installed the native libgit2 library (via Nuget or source & building it manually)? https://mcmap.net/q/1175825/-not-able-to-run-libgit2sharp-on-mono-on-ubuntu github.com/libgit2/libgit2 – Kilbridegit2-785d8c4
(.dll
/.dylib
/.so
) native library that the C# library is trying to load? – Kilbride.dll
, I am assuming you have the correct one and you are on Windows OS? If so, during the build process is it not being copied to the output directory with the CIL-based assembies (your program files and libgit2sharp.dll)? – Kilbride