Skip to content

Commit 072d879

Browse files
Prefer MinGit ssh over system OpenSSH on Windows, keeping OpenSSH as fallback
1 parent 2d48986 commit 072d879

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,15 +2641,6 @@ public File getSSHExecutable() {
26412641
return sshexe;
26422642
}
26432643

2644-
// Check for ssh.exe on the system PATH (supports Microsoft OpenSSH and other alternate implementations)
2645-
String sshPath = getPathToExe("ssh");
2646-
if (sshPath != null) {
2647-
sshexe = new File(sshPath);
2648-
if (sshexe.exists()) {
2649-
return sshexe;
2650-
}
2651-
}
2652-
26532644
// Check Program Files
26542645
sshexe = getFileFromEnv("ProgramFiles", "\\Git\\bin\\ssh.exe");
26552646
if (sshexe != null && sshexe.exists()) {
@@ -2709,6 +2700,15 @@ public File getSSHExecutable() {
27092700
}
27102701
}
27112702

2703+
// Check for ssh.exe on the system PATH as last resort (supports Microsoft OpenSSH and other alternate implementations)
2704+
String sshPath = getPathToExe("ssh");
2705+
if (sshPath != null) {
2706+
sshexe = new File(sshPath);
2707+
if (sshexe.exists()) {
2708+
return sshexe;
2709+
}
2710+
}
2711+
27122712
throw new RuntimeException(
27132713
"ssh executable not found. The git plugin only supports official git client https://git-scm.com/download/win");
27142714
}

0 commit comments

Comments
 (0)