我有一个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
不确定我是否在这里遗漏了什么。请指教..