I have a git parent repository which contains a sub-module. Now I have modified few files which are available in the sub-module and few files in the parent module as well. My Goal is to push the changes using JGit API to the remote repository, so that both parent and sub-module would reflect my changes.
I can only able to commit and push the changes of the parent repository, whereas while pushing the sub-module changes the below exception is occurred:
"org.eclipse.jgit.api.errors.TransportException: Nothing to push."
Git submoduleGitObj = new Git(submoduleRepository)
submoduleGitObj.commit().setAuthor("testUser", "testUser@gmail.com").setAll(false)
.setMessage(commitMessage).call(); // commit is successful
submoduleGitObj .push().setRemote("origin").setCredentialsProvider(credentialsProvider).call(); // throws exception and push is unsuccessful
Using JGit, I could be able to successfully commit and push the changes of both sub-module and the parent module