Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -2626,6 +2626,15 @@
return sshexe;
}

// Check for ssh.exe on the system PATH (supports Microsoft OpenSSH and other alternate implementations)
String sshPath = getPathToExe("ssh");
if (sshPath != null) {
sshexe = new File(sshPath);
if (sshexe.exists()) {
return sshexe;

Check warning on line 2634 in src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 2630-2634 are not covered by tests
}
}

// Check Program Files
sshexe = getFileFromEnv("ProgramFiles", "\\Git\\bin\\ssh.exe");
if (sshexe != null && sshexe.exists()) {
Expand Down Expand Up @@ -2701,7 +2710,8 @@
w.write("setlocal enabledelayedexpansion");
w.newLine();
w.write("\"" + sshexe.getAbsolutePath()
+ "\" -i \"!JENKINS_GIT_SSH_KEYFILE!\" -l \"!JENKINS_GIT_SSH_USERNAME!\" "
+ "\" -n -T -i \"!JENKINS_GIT_SSH_KEYFILE!\" -l \"!JENKINS_GIT_SSH_USERNAME!\" "
+ "-o BatchMode=yes -o PasswordAuthentication=no "
+ getHostKeyFactory().forCliGit(listener).getVerifyHostKeyOption(knownHosts) + " %* ");
w.newLine();
}
Expand All @@ -2724,7 +2734,8 @@
w.newLine();
w.write("fi");
w.newLine();
w.write("ssh -i \"$JENKINS_GIT_SSH_KEYFILE\" -l \"$JENKINS_GIT_SSH_USERNAME\" "
w.write("ssh -n -T -i \"$JENKINS_GIT_SSH_KEYFILE\" -l \"$JENKINS_GIT_SSH_USERNAME\" "
+ "-o BatchMode=yes -o PasswordAuthentication=no "
+ getHostKeyFactory().forCliGit(listener).getVerifyHostKeyOption(knownHosts) + " \"$@\"");
w.newLine();
}
Expand Down
Loading