一个简单的方法来调试这是看的测试AddCommand在JGit回购:
AddCommandTest.java
您将看到,为了添加所有文件,
*从不使用模式“ ”,而是使用“
.”。
它用在名为…
testAddWholeRepo()(!)的测试函数中
git.add().addFilepattern(".").call();例外:
Exception in thread "main" org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
非常明确:您需要在非裸仓库中添加文件。
查看测试方法
testCloneRepository()以与您自己的克隆进行比较,并查看是否存在任何差异。



