我读了question and answer for staging files in a non-bare repository .但是,我正在使用一个裸存储库,我想暂存文件。
我尝试使用 test for DirCacheBuilder ,但代码 Repository.lockDirCache()
或 Repository.readDirCache()
失败,因为这是一个裸存储库。
org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index at org.eclipse.jgit.lib.Repository.getIndexFile(Repository.java:993) at org.eclipse.jgit.dircache.DirCache.read(DirCache.java:166) at org.eclipse.jgit.lib.Repository.readDirCache(Repository.java:1017)
那么,我如何使用 JGit 在裸存储库中暂存文件?这甚至可能吗?
最佳答案
how could I stage files in a bare repository using JGit?
你不会,因为错误指出:
Bare Repository has neither a working tree, nor an index
没有索引,意味着没有暂存。
关于java - 如何在裸存储库中使用 JGit 暂存文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25549389/