Commit 04cadf9
committed
fix(git): Use Apache HttpClient for JGit HTTP transport
JGit defaults to `java.net.HttpURLConnection` for HTTP(S) connections
[1]. This implementation caches Basic Auth credentials [2] [3], which
causes problems when accessing multiple repositories on the same host
with different credentials.
For example, when cloning GitHub repositories over HTTPS,
`HttpURLConnection` stores credentials under the cache key
`s:BASIC:https:github.com:443:GitHub`. Cloning a second repository with
different credentials then reuses the cached credentials from the first
clone, resulting in authentication failures.
Switch JGit's HTTP transport to Apache HttpClient, which does not
exhibit this credential caching behavior.
[1]: https://github.com/eclipse-jgit/jgit/blob/v7.4.0.202509020913-r/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/JDKHttpConnection.java
[2]: https://bugs.openjdk.org/browse/JDK-6626700
[3]: https://github.com/openjdk/jdk/blob/676e6fd8d5152f4e0d14ae59ddd7aa0a7127ea58/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java#L306-L308
Signed-off-by: Marcel Bochtler <[email protected]>1 parent 111cf53 commit 04cadf9
File tree
3 files changed
+9
-0
lines changed- gradle
- plugins/version-control-systems/git
- src/main/kotlin
3 files changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
107 | 113 | | |
108 | 114 | | |
109 | 115 | | |
| |||
0 commit comments