|
17 | 17 |
|
18 | 18 |
|
19 | 19 | import com.diffplug.common.collect.Iterables; |
| 20 | +import com.jcraft.jsch.Session; |
20 | 21 | import java.io.File; |
21 | 22 | import java.io.IOException; |
22 | 23 | import java.util.Arrays; |
23 | 24 | import java.util.List; |
24 | 25 | import java.util.Objects; |
25 | 26 | import java.util.Optional; |
26 | 27 | import java.util.function.Consumer; |
27 | | -import com.jcraft.jsch.Session; |
28 | 28 | import org.eclipse.jgit.api.Git; |
29 | 29 | import org.eclipse.jgit.api.PushCommand; |
30 | | -import org.eclipse.jgit.api.TransportConfigCallback; |
31 | 30 | import org.eclipse.jgit.api.errors.GitAPIException; |
32 | 31 | import org.eclipse.jgit.lib.ConfigConstants; |
33 | 32 | import org.eclipse.jgit.lib.Constants; |
|
41 | 40 | import org.eclipse.jgit.transport.RefSpec; |
42 | 41 | import org.eclipse.jgit.transport.RemoteRefUpdate; |
43 | 42 | import org.eclipse.jgit.transport.SshTransport; |
44 | | -import org.eclipse.jgit.transport.Transport; |
45 | 43 | import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; |
46 | 44 |
|
47 | 45 | /** API for doing the commit, tag, and push operations. See {@link GitCfg#withChangelog(File, ChangelogAndNext)}. */ |
@@ -130,16 +128,14 @@ private void push(Consumer<PushCommand> cmd, RemoteRefUpdate.Status expected) th |
130 | 128 | if (remoteUrl.startsWith("http://") || remoteUrl.startsWith("https://")) { |
131 | 129 | push = push.setCredentialsProvider(creds()); |
132 | 130 | } else if (remoteUrl.startsWith("ssh://")) { |
133 | | - push.setTransportConfigCallback(new TransportConfigCallback() { |
134 | | - @Override |
135 | | - public void configure(Transport transport) { |
136 | | - SshTransport sshTransport = (SshTransport) transport; |
137 | | - sshTransport.setSshSessionFactory(new JschConfigSessionFactory() { |
138 | | - @Override |
139 | | - protected void configure(OpenSshConfig.Host host, Session session ) { |
140 | | - } |
141 | | - }); |
142 | | - } |
| 131 | + push.setTransportConfigCallback(transport -> { |
| 132 | + SshTransport sshTransport = (SshTransport) transport; |
| 133 | + sshTransport.setSshSessionFactory(new JschConfigSessionFactory() { |
| 134 | + @Override |
| 135 | + protected void configure(OpenSshConfig.Host host, Session session) { |
| 136 | + session.setConfig("StrictHostKeyChecking", "no"); |
| 137 | + } |
| 138 | + }); |
143 | 139 | }); |
144 | 140 | } |
145 | 141 |
|
|
0 commit comments