0

Need help in pushing files to an existing branch using Jgit.
I tried:

git.checkout().setName(existingBranchName).call();
git.add().addFilePattern(fileName).call();
git.commit().setMessage("commit message").call();
git.push().setRemote("origin").setCredentialProvider(credentials).call();

Not getting any exceptions but the commit is not pushed to that branch.

Friend
  • 1
  • 2
  • The `PushCommand` returns a `PushResult` that you can inspect to see what the command did. – Rüdiger Herrmann Aug 08 '20 at 08:41
  • Does this answer your question? [How do I do git push with JGit?](https://stackoverflow.com/questions/13446842/how-do-i-do-git-push-with-jgit) I think you didn't set a remote. – dan1st Aug 08 '20 at 08:47
  • Tried adding remote still no changes to the remote repo and there is no error also – Friend Aug 08 '20 at 17:18
  • Have you tried out the idea of RüdigerHerrmann? – dan1st Aug 08 '20 at 17:20
  • Yes, I have seen it returned Iterable didn't get exactly what I have to found. Could you provide small code snippet If possible – Friend Aug 10 '20 at 01:37

0 Answers0