Question

Using jgit, I am writing codes on ToolTwist Controller that will automatically synch (pull and push) local repository to github but I am getting this error when trying to call pull command:

org.eclipse.jgit.api.errors.InvalidConfigurationException: No value for key branch.master.merge found in configuration

Take notes that push command work fine.

Was it helpful?

Solution

I think this is caused by an incorrect initialization. From the resource beneath, it seems the remote of your branch is not set (i.e. at the initialization, you did not call setRemote(your_remote) on your Repository/Git object).

If this does not work, look for the targetted commit, maybe there is none (for instance if the repository is just created).

You will find a more precise answer on this page: http://www.kernel.org/pub/software/scm/git/docs/v1.7.3/git-config.html

Search for branch.<name>.merge on this page.

I hope it'll help you

OTHER TIPS

I had this error today, and it was caused by the fact that the first clone was done into a bare repository. if the clone was done into a repository that had already a commit, the .Pull worked fine (I'm using NGit)

You just need to set the value for this configuration.

StoredConfig config = git.getRepository().getConfig();
config.setString("remote", "origin", "fetch", "+refs/*:refs/*");
config.save();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top