我需要使用libgit2sharp将本地存在的标签推送到远程。但是我不知道该怎么做。
我在libgit2sharp的github存储库(问题和测试用例)中搜索了很多,但什么也没有找到。
There are some discussions谈到了git push --tags的替代方案,人们说这个命令只是git push <remote> refs/tags/*:refs/tags/*的语法糖,它正是你在libgit2sharp中需要做的,以便让你的标签被推送。
但是我如何翻译这个命令呢?
git push <remote> refs/tags/*:refs/tags/*转换成libgit2sharp代码?
谢谢你们所有人。
发布于 2016-06-10 05:00:05
好吧,我在我的方法中发现了问题。我是这样做的:
repo.Network.Push(repo.Network.Remotes["origin"], @"refs/tags/*", options);但是libgit2sharp不允许使用通配符(*)。然后,我做了一个测试,删除通配符,并将其更改为我的一个标签的名称,它工作了。
但我仍然需要发送多个标记到远程,我使用foreach循环做了一个变通方法,如下所示:
foreach (var tag in repositorio.Tags)
{
repo.Network.Push(repo.Network.Remotes["origin"], tag.CanonicalName, options);
}有没有其他(更好的或正确的)方法呢?
https://stackoverflow.com/questions/37734855
复制相似问题