import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.Transport;
private int timeout;
+ private CredentialsProvider credentialsProvider;
+
/**
* @param repo
transport.setTimeout(timeout);
transport.setDryRun(dryRun);
transport.setFetchThin(thin);
+ transport.setCredentialsProvider(credentialsProvider);
try {
FetchResult result = transport.fetch(monitor, refSpecs);
return this;
}
+ /**
+ * @param credentialsProvider
+ * the {@link CredentialsProvider} to use
+ */
+ public void setCredentialsProvider(CredentialsProvider credentialsProvider) {
+ this.credentialsProvider = credentialsProvider;
+ }
}
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
private int timeout;
+ private CredentialsProvider credentialsProvider;
+
/**
* @param repo
*/
if (receivePack != null)
transport.setOptionReceivePack(receivePack);
transport.setDryRun(dryRun);
+ transport.setCredentialsProvider(credentialsProvider);
final Collection<RemoteRefUpdate> toPush = transport
.findRemoteRefUpdatesFor(refSpecs);
return this;
}
+ /**
+ * @param credentialsProvider
+ * the {@link CredentialsProvider} to use
+ */
+ public void setCredentialsProvider(CredentialsProvider credentialsProvider) {
+ this.credentialsProvider = credentialsProvider;
+ }
}