我正在尝试使用master
从remote
提取libgit2sharp
分支。
有时我必须将remote
更改为其他网址并从remote
拉出来。
当我更改remote
并尝试pull
时,我收到此错误:
There is no tracking information for the current branch
我知道我必须使用git git branch --set-upstream-to=origin/master master
解决此问题,但我想知道如何使用libgit2sharp
执行相同操作?
答案 0 :(得分:0)
给定mybranch,一个Branch
实例,它已配置为跟踪origin
远程中的分支。
如果你愿意做的就是重新配置遥控器(同时保持本地和远程跟踪分支配置),再到另一个(例如“myOtherRemote”),那么下面的代码应该可以解决问题。 / p>
repo.Branches.Update(myBranch, b => b.Remote = "myOtherRemote");