Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Error pushing to remote

I'm using the jgit.jar in a custom web application. I'm using the following code to push local repo changes to master:

String remote = "origin";
String branch = "refs/heads/master";
String trackingBranch = "refs/remotes/" + remote + "/master";
RefSpec spec = new RefSpec(branch + ":" + branch);
Iterable<PushResult> resultIterable = git.push().setRemote(remote)
.setRefSpecs(spec).call();
PushResult result = resultIterable.iterator().next();
TrackingRefUpdate trackingRefUpdate = result
.getTrackingRefUpdate(trackingBranch);

When I use this code in a standalone java class (i.e. with  public static void main method), it works just fine. But when I incorporate this into my project, it fails with the following error:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jgit.transport.Transport
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:144) [org.eclipse.jgit-3.1.0.201310021548-r.jar:3.1.0.201310021548-r]

I have jsch.jar in the class path as well. Not sure why this is failing.

Back to the top