को व्यवस्थित करने के लिए सभी फ़ाइलों को कैसे जोड़ना है मैंने jGit (यह काम करता है) के साथ एक रेपो क्लोन करने के कई तरीकों से प्रयास किया। फिर, मैं भंडार में कुछ संग्रह लिखता हूं, और सभी को जोड़ने की कोशिश करता हूं (git add *
, git add -A
या ऐसा कुछ) .. लेकिन यह काम नहीं करता है। सरल फ़ाइलों को स्टेजिंग क्षेत्र में जोड़ा नहीं जाता है।jGit - क्षेत्र
मेरे कोड इस तरह है:
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Repository repository = builder.setGitDir(new File(folder))
.readEnvironment().findGitDir().setup().build();
CloneCommand clone = Git.cloneRepository();
clone.setBare(false).setCloneAllBranches(true);
clone.setDirectory(f).setURI("[email protected]:test.git");
try {
clone.call();
} catch (GitAPIException e) {
e.printStackTrace();
}
Files.write("testing it...", new File(folder + "/test2.txt"),
Charsets.UTF_8);
Git g = new Git(repository);
g.add().addFilepattern("*").call();
क्या मैं गलत कर रहा हूँ? धन्यवाद। AddCommandTest.java
: JGit repo में AddCommand के परीक्षण को देखने के लिए
Exception in thread "main" org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
at org.eclipse.jgit.lib.Repository.getIndexFile(Repository.java:850)
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:264)
at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:906)
at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:138)
at net.ciphersec.git.GitTests.main(GitTests.java:110)
धन्यवाद, लेकिन मुझे अपवाद मिला। मैं इसे – caarlos0
@ caarlos0 उत्तर में संपादित कर दूंगा – VonC
लेकिन मैंने इसे गैर-नंगे भंडार के रूप में क्लोन किया है ... मुझे यह नहीं पता कि मुझे क्या करना है ... – caarlos0