9

何时尝试执行以下方法(使用 JGIT 库)

 private void pullRepo() throws  IOException,GitAPIException, WrongRepositoryStateException, InvalidConfigurationException, DetachedHeadException, InvalidRemoteException, CanceledException, RefNotFoundException, NoHeadException{
            Git  git = new Git(localRepo);
            git.pull().call();
    }

我得到以下运行时异常:

org.eclipse.jgit.api.errors.NoHeadException: Pull on repository without HEAD currently not supported
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:161)

有人知道如何解决这个问题吗?我使用的 localRepo 与我使用的 cloneRepository 方法相同,效果很好。

谢谢,bgvv1983

4

1 回答 1

10

认为我发现了我的错误。在我的项目文件夹中位于错误的级别。

我在 ../project (在你的 shell 中工作)级别而不是 ../project/.git 级别。

于 2013-08-11T15:12:29.713 回答