I got the solution. An Eclipse community member gave me some ideas on it.
Here's that thread: http://www.eclipse.org/forums/index.php/m/1176786/#msg_1176786
I needed to set the proxy configuration for JGit, using the ProxySelector
class.
ProxySelector.setDefault(new ProxySelector(){
final ProxySelector delegate = ProxySelector.getDefault();
@Override
public List<Proxy> select(URI uri) {
// Filter the URIs to be proxied
if (uri.toString().contains("github") && uri.toString().contains("https")) {
return Arrays.asList(new Proxy(Type.HTTP,
InetSocketAddress.createUnresolved("localhost", 3128)));
}
if (uri.toString().contains("github") & uri.toString().contains("http")) {
return Arrays.asList(new Proxy(Type.HTTP,
InetSocketAddress.createUnresolved("localhost", 3129)));
}
// revert to the default behaviour
return delegate == null ? Arrays.asList(Proxy.NO_PROXY) : delegate.select(uri);
}
@Override
public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
if (uri == null || sa == null || ioe == null) {
throw new IllegalArgumentException("Arguments can't be null.");
}
}
});
In my case "localhost"/3128
and localhost"/3129
were the HTTPS and HTTP proxy URL/Port respectively, that I wanted to use.
Ref: JGit proxy configuration in code
It worked well.