jenkinsci / jenkinsci/git-client-plugin

[JENKINS-72450] Support alternate ssh implementations on Windows

Open
#1,676 6 comments 0 reactions 0 assignees View on GitHub
component:git-client-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
152
Forks
402
Avg merge
6h 47m
Merged PRs (30d)
4

Description

We are setting up a new Windows 2021 build node. This build node is connected from our Jenkins server using a ssh connection. This is done by using the "Microsoft OpenSSH Server 9.2.20".

We are Running as scripted Pipeline with the following part:



stage('checkout') {

sh 'which ssh'

bat 'where ssh'

checkout([$class: 'GitSCM', branches: [[name: """$COMMIT"""]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'd7695a83-ac09-4660-8b95-74094f8059a5', url: GIT_URL]]])

// set COMMIT_SHA1 variable with the checked out commit SHA1

COMMIT_SHA1=sh script:'git rev-parse --verify HEAD', returnStdout: true

}

this results in the Error: "ssh executable not found."


15:34:59 [Pipeline] stage

15:34:59 [Pipeline] { (checkout)

15:34:59 [Pipeline] sh

15:35:00 + which ssh

15:35:00 /c/Program Files/OpenSSH/ssh

15:35:00 [Pipeline] bat

15:35:00

15:35:00 oaad\xentcon@​GCDXENTCON31 F:\X.com-CIB>where ssh

15:35:00 C:\Program Files\OpenSSH\ssh.exe

15:35:00 [Pipeline] checkout

15:35:00 The recommended git tool is: NONE

15:35:00 using credential d7695a83-ac09-4660-8b95-74094f8059a5

15:35:00 Fetching changes from the remote Git repository

15:35:00 [Pipeline] }

15:35:00 [Pipeline] // stage

15:35:00 [Pipeline] echo

15:35:00 catch2

15:35:00 [Pipeline] echo

15:35:00 java.lang.RuntimeException: ssh executable not found. The git plugin only supports official git client https://git-scm.com/download/win

This pipeline is running without any problems with no change on an jnlp client Windows.

For me it looks like the git-plugin expects to have an external ssh.exe in the path

C:\Program Files\OpenSSH\ssh.exe

which is definitely available. The PATH in the gitbash is:

PATH=/cmd:/mingw64/bin:/usr/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/OpenSSH:/c/ProgramData/GooGet:/c/Program Files/Google/Compute Engine/metadata_scripts:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/Program Files/PowerShell/7:/c/Program Files/Google/Compute Engine/sysprep:/cmd:.:/c/JavaInPath/bin:/c/PerlInPath/bin:/c/PerlInPath/site/bin:/c/strawberry/c/bin:/c/CMUtils:/c/PythonInPath:/c/Users/xentcon/AppData/Local/Microsoft/WindowsApps

---
Originally reported by brosmar, imported from: Support alternate ssh implementations on Windows


  • assignee: markewaite
  • status: Open
  • priority: Minor
  • component(s): git-client-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 20251211-071809

Raw content of original issue

We are setting up a new Windows 2021 build node. This build node is connected from our Jenkins server using a ssh connection. This is done by using the "Microsoft OpenSSH Server 9.2.20".
We are Running as scripted Pipeline with the following part:



stage('checkout') {
sh 'which ssh'
bat 'where ssh'
checkout([$class: 'GitSCM', branches: [[name: """$COMMIT"""]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'd7695a83-ac09-4660-8b95-74094f8059a5', url: GIT_URL]]])
// set COMMIT_SHA1 variable with the checked out commit SHA1
COMMIT_SHA1=sh script:'git rev-parse --verify HEAD', returnStdout: true
}

this results in the Error: "ssh executable not found."


15:34:59 [Pipeline] stage
15:34:59 [Pipeline] { (checkout)
15:34:59 [Pipeline] sh
15:35:00 + which ssh
15:35:00 /c/Program Files/OpenSSH/ssh
15:35:00 [Pipeline] bat
15:35:00
15:35:00 oaad\xentcon@GCDXENTCON31 F:\X.com-CIB>where ssh
15:35:00 C:\Program Files\OpenSSH\ssh.exe
15:35:00 [Pipeline] checkout
15:35:00 The recommended git tool is: NONE
15:35:00 using credential d7695a83-ac09-4660-8b95-74094f8059a5
15:35:00 Fetching changes from the remote Git repository
15:35:00 [Pipeline] }
15:35:00 [Pipeline] // stage
15:35:00 [Pipeline] echo
15:35:00 catch2
15:35:00 [Pipeline] echo
15:35:00 java.lang.RuntimeException: ssh executable not found. The git plugin only supports official git client https://git-scm.com/download/win

This pipeline is running without any problems with no change on an jnlp client Windows.

For me it looks like the git-plugin expects to have an external ssh.exe in the path
C:\Program Files\OpenSSH\ssh.exe
which is definitely available. The PATH in the gitbash is:

PATH=/cmd:/mingw64/bin:/usr/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/OpenSSH:/c/ProgramData/GooGet:/c/Program Files/Google/Compute Engine/metadata_scripts:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/Program Files/PowerShell/7:/c/Program Files/Google/Compute Engine/sysprep:/cmd:.:/c/JavaInPath/bin:/c/PerlInPath/bin:/c/PerlInPath/site/bin:/c/strawberry/c/bin:/c/CMUtils:/c/PythonInPath:/c/Users/xentcon/AppData/Local/Microsoft/WindowsApps

environment

```
Jenkins Cloud Bees Server 2.414.3.8 on RedHat.

Git-plugin Version 5.2

Git-client-plugin Version 4.5

Jenkins Node:

OS Name Microsoft Windows Server 2022 Datacenter

Version 10.0.20348 Build 20348

OS Manufacturer Microsoft Corporation

SSH: Microsoft OpenSSH Server 9.2.20

Git: Git-2.43.0-64-bit (installed without own SSH Support)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.