使用libgit2sharp删除远程标记

时间:2018-02-19 17:41:05

标签: c# git libgit2sharp

我尝试使用libgit2sharp(v0.24.0)删除git中的远程标记失败了。我跟着https://github.com/libgit2/libgit2sharp/issues/466,但这两项建议都不适合我。

我在删除远程分支时遇到了related post,但是,这也没有用。

我在libgit2sharp库周围有一个简单的包装器,我使用NUnit来执行DeleteTagRemote方法。

这是包装代码:

public void DeleteTagRemote(string tagName)
{
    using (var repo = new Repository(repoPath))
    {
        var tag = repo.Tags[tagName];
        var remote = repo.Network.Remotes["origin"];

        repo.Network.Push(remote, pushRefSpec: ":" + tag.FriendlyName);
    }
}

这会导致推送方法LibGit2Sharp.LibGit2SharpException: 'not a valid reference 'TestTag_v0.1''

如果我使用objectish: null, destinationSpec: "my-branch"尝试其他选项,我会

System.ArgumentNullException: 'Value cannot be null.
Parameter name: objectish'

最后,如果我尝试repo.Network.Push(remote, ":" + tag.CanonicalName);,我会

LibGit2Sharp.LibGit2SharpException: 'failed to rename lockfile to '*.idx': The process cannot access the file because it is being used by another process.

我已经提交,创建标记,将提交和标记推送到远程,并删除本地标记以便工作。我不确定我错过了这个。

0 个答案:

没有答案
相关问题