问题
I'm using LibGit2Sharp and after cloning the repository and try to call the PULL command, always gives the same error. I've tried to use checkout, reset, merging and not changed.
public void RecuperarRepositorio()
{
if (!Directory.Exists(DS_CAMINHO_DESTINO + @"\.git"))
CriarRepositorio();
else
AtualizarRepositorio();
}
private void CriarRepositorio()
{
var path = Repository.Clone(DS_CAMINHO_GIT, DS_CAMINHO_DESTINO, RetornaCloneOptions());
}
private void AtualizarRepositorio()
{
using (var repo = new Repository(DS_CAMINHO_DESTINO + @"\.git\"))
{
foreach (Remote remote in repo.Network.Remotes)
repo.Network.Fetch(remote, RetornaPullOptions().FetchOptions);
repo.Network.Pull(RetornaAssinatura(), RetornaPullOptions());
}
}
private CloneOptions RetornaCloneOptions()
{
var co = new CloneOptions();
co.BranchName = NM_BRANCH;
co.CredentialsProvider = (_url, _user, _cred) => RetornaCredencial();
co.CertificateCheck += delegate(Certificate certificate, bool valid, string host) { return true; };
return co;
}
private PullOptions RetornaPullOptions()
{
var po = new PullOptions();
po.FetchOptions = new FetchOptions();
po.FetchOptions.TagFetchMode = TagFetchMode.All;
po.FetchOptions.CredentialsProvider = (_url, _user, _cred) => RetornaCredencial();
po.FetchOptions.CertificateCheck += delegate(Certificate certificate, bool valid, string host) { return true; };
po.MergeOptions = new MergeOptions();
po.MergeOptions.FileConflictStrategy = CheckoutFileConflictStrategy.Theirs;
return po;
}
来源:https://stackoverflow.com/questions/37215864/libgit2sharp-the-current-branch-is-configured-to-merge-with-the-reference-f