Skip to content

Commit

Permalink
Check for ssh.exe in usr/bin in addition to bin
Browse files Browse the repository at this point in the history
[Fix JENKINS-30045] Windows git 2.5.0 can't find ssh

[Fix JENKINS-30032] Windows git 2.5.0 can't find ssh
  • Loading branch information
MarkEWaite committed Aug 20, 2015
1 parent 6271ad9 commit b6fe319
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
Expand Up @@ -1529,12 +1529,20 @@ private File getSSHExeFromGitExeParentDir(String userGitExe) {
if (sshexe != null && sshexe.exists()) {
return sshexe;
}
sshexe = getFileFromEnv("ProgramFiles", "\\Git\\usr\\bin\\ssh.exe");
if (sshexe != null && sshexe.exists()) {
return sshexe;
}

// Check Program Files(x86) for 64 bit computer
sshexe = getFileFromEnv("ProgramFiles(x86)", "\\Git\\bin\\ssh.exe");
if (sshexe != null && sshexe.exists()) {
return sshexe;
}
sshexe = getFileFromEnv("ProgramFiles(x86)", "\\Git\\usr\\bin\\ssh.exe");
if (sshexe != null && sshexe.exists()) {
return sshexe;
}

// Search for an ssh.exe near the git executable.
sshexe = getSSHExeFromGitExeParentDir(gitExe);
Expand All @@ -1552,6 +1560,10 @@ private File getSSHExeFromGitExeParentDir(String userGitExe) {
if (sshexe != null && sshexe.exists()) {
return sshexe;
}
sshexe = getSSHExeFromGitExeParentDir(gitPath.replace("/cmd/", "/usr/bin/").replace("\\cmd\\", "\\usr\\bin\\"));
if (sshexe != null && sshexe.exists()) {
return sshexe;
}
}

throw new RuntimeException("ssh executable not found. The git plugin only supports official git client http://git-scm.com/download/win");
Expand Down

0 comments on commit b6fe319

Please sign in to comment.