jgit/org.eclipse.jgit.pgm
Matthias Sohn 2647d024af Fix push with jgit pgm failing with "unauthorized"
Pushing with JGit commandline to e.g. Github failed with "unauthorized"
since HttpUrlConnection calls the configured authenticator implicitly.

The problem is that during a push two requests are sent to the server,
first a GET and then a POST (containing the pack data). The first GET
request sent anonymously is rejected with 401 (unauthorized). When an
Authenticator is installed the java.net classes will use the
Authenticator to ask the user for credentials and retry the request.
But this happens under the hood and JGit level code doesn't see that
this happens.

The next request is the POST but since JGit thinks the first GET request
went through anonymously it doesn't add authentication headers to the
POST request. This POST of course also fails with 401 but since this
request contains a lot of body-data streamed from JGit (the pack file!)
the java.net classes can't simply retry the request with authorization
headers. The whole process fails.

Fix this by using Apache httpclient which doesn't use Authenticator to
retrieve credentials. Instead initialize TransportCommand to use the
default credential provider if no other credentials provider was set
explicitly. org.eclipse.jgit.pgm.Main sets this default for the JGit
command line client.

Change-Id: Ic4e0f8b60d4bd6e69d91eae0c7e1b44cdf851b00
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2015-12-15 12:49:08 +01:00
..
.settings Update dependencies to use the JGit-internal @Nullable 2015-11-09 14:27:52 -08:00
META-INF Fix push with jgit pgm failing with "unauthorized" 2015-12-15 12:49:08 +01:00
resources Add remote command to JGit CLI 2015-12-11 22:54:48 +01:00
src/org/eclipse/jgit Fix push with jgit pgm failing with "unauthorized" 2015-12-15 12:49:08 +01:00
.classpath Set minimum required Java version to Java 7 2015-02-09 14:11:50 +01:00
.gitignore Finish removing Apache Felix maven-bundle-plugin 2010-01-12 11:46:55 -08:00
.project Enforce the use of Java5 API:s only (with a few exceptions) 2011-12-16 01:01:36 +01:00
about.html Add missing about.html files to all shipped bundles 2011-06-08 21:51:51 +02:00
build.properties Add missing resources from source.. in build.properties 2013-10-30 17:42:38 +01:00
jgit.sh Make jgit.sh work on windows when JGIT_CLASSPATH is set 2014-12-01 14:54:17 +01:00
plugin.properties Fix plugin provider names to conform with release train requirement 2013-04-08 23:05:36 +02:00
pom.xml Fix push with jgit pgm failing with "unauthorized" 2015-12-15 12:49:08 +01:00