libgit2sharp remove remote branch

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 21:55:55

This is failing with a 401 Unauthorized error because it is unauthorized. To fix this error, you just need to pass the options containing your credentials to the Push() method:

repository.Network.Push(remote, pushRefSpec, options)

That fixed this problem for me.

I just figured out the solution from the libgit2 sourcecode.

repository.Network.Push(origin, "+:/refs/heads/to-remove-branch")

The part +:/refs/heads/to-remove-branch of the refspec specifies that the remove command is forced, else just use :/refs/heads/to-remove-branch

Source: https://github.com/libgit2/libgit2/blob/master/tests/online/push.c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!