I want to create a Java program that
- connects to a specific Git repository,
- adds text to the file,
- fixes and
- causes changes to this repository.
Ideally, all this should happen in memory.
I use JGit to interact with Git:
InMemoryRepository repo = new InMemoryRepository(new DfsRepositoryDescription()); Git git = new Git(repo); git.init().call(); PullCommand pull = git.pull(); StoredConfig config = git.getRepository().getConfig(); config.setString("remote", "origin", "url", "https://XXX"); config.save(); PullResult result = pull.call();
pull.call() the following exception:
org.eclipse.jgit.api.errors.NoHeadException: Pull on repository without HEAD currently not supported at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:191)
How can I get the contents of a repository to a JGit repository in memory?
source share