我有一个来自远程仓库的本地存储库cloned
。
我做了Fetch
并抛出以下异常:
libgit2引发了一个错误。类别=参考(错误)。目标 存储库中不存在引用的OID
堆栈跟踪对于例外:
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in D:\Personal\Projects\LibGitSharp\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line77
at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in D:\Personal\Projects\LibGitSharp\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 96
at LibGit2Sharp.Core.Proxy.git_remote_update_tips(RemoteSafeHandle remote) in D:\Personal\Projects\LibGitSharp\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line1435
这是我的代码:
public void Fetch()
{
var remote = this.LibGit2SharpRepo.Network.Remotes.FirstOrDefault();
if (remote != null)
{
this.LibGit2SharpRepo.Fetch(remoteName:"origin");
//TODO : Soft reset to the latest commit
}
}
private IRepository _libGit2SharpRepo;
public IRepository LibGit2SharpRepo
{
get { return _libGit2SharpRepo ?? (_libGit2SharpRepo = new Repository(this.RepositoryPath)); }
}
另外,我的远程仓库也在我的本地磁盘上
[remote "origin"]
fetch = +refs/heads/\*:refs/remotes/origin/\*
url = D:\\MyTestRepo\\Data\\RemoteGitRepo.git
不确定我在这里遗失了什么。请指教..