I am using libgit2sharp to on a proof of concept to automate fetching, changing, commiting some files, and pushing to a remote origin.
I know that push is still not finished yet, but fetch is in vnext but when I call it:
An error was raised by libgit2. Category = Os (Error). Failed to connect to host
Here is my code:
using (var repo = new Repository(gitPath))
{
var allBranches = repo.Branches.ToList(); //works fine
var creds = new Credentials() {Username = username, Password = password};
var remote = repo.Remotes.FirstOrDefault(x => x.Name == "origin");
remote.Fetch(credentials:creds); //blows up here
}
Some other details:
- My remote is private bitbucket hosted using https. (looks like: https://[email protected]/myRepoOwner/repoName.git)
- I am able to fetch and push from the command line, so the repo is working.
- The same issue happens when I use repo.Fetch("origin");