I want to create and delete a branch on git using libgit2sharp. I came up with this code but it throws an error at repo.Network.Push(localBranch, pushOptions);
using (var repo = new Repository(GIT_PATH))
{
var branch = repo.CreateBranch(branchName);
var localBranch = repo.Branches[branchName];
//repo.Index.Stage(GIT_PATH);
repo.Checkout(localBranch);
repo.Commit("Commiting at " + DateTime.Now);
var pushOptions = new PushOptions() { Credentials = credentials };
repo.Network.Push(localBranch, pushOptions); // error
branch = repo.Branches["origin/master"];
repo.Network.Push(branch, pushOptions);
}
The error message is The branch 'buggy-3' ("refs/heads/buggy-3") that you are trying to push does not track an upstream branch.
I tried searching this error on the internet but no solution that I found could fix the problem. Is it possible to do this using libgit2sharp?