jenkinsci / jenkinsci/git-plugin

[JENKINS-30156] failure to clone repo on windows with git_ssh using plink

Open
#2,715 3 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

jenkins fails to clone a remote repo on windows - and the issue is it is passing invalid arguments to git_ssh.

```
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@​github.com:jtnord/cjp-champagne-lib.git # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
No valid HEAD. Skipping the resetting
> git clean -fdx # timeout=10
Fetching upstream changes from git@​github.com:jtnord/cjp-champagne-lib.git
> git --version # timeout=10
using GIT_SSH to set credentials temp ssh key for jenkins
> git -c core.askpass=true fetch --tags --progress git@​github.com:jtnord/cjp-champagne-lib.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@​github.com:jtnord/cjp-champagne-lib.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:763)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1012)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$StepRunner.run(AbstractSynchronousNonBlockingStepExecution.java:75)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@​github.com:jtnord/cjp-champagne-lib.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: plink: unknown option "-o"
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1388)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:62)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:313)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:761)
... 11 more

```

jenkins is run from the command line (java -jar .... as it is for testing purposes) on a windows machine.

GIT_SSH is set in the windows environment to GIT_SSH=c:\Program Files (x86)\PuTTY\plink.exe

The checkout is in a workflow which uses credentials (the following step)

```
checkout([$class: 'GitSCM', branches: [[name: '*/functions_timestamp']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'cjp-champagne-lib']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'github', url: 'git@​github.com:jtnord/cjp-champagne-lib.git']]])

```

---
Originally reported by teilo, imported from: failure to clone repo on windows with git_ssh using plink


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-02

Raw content of original issue

jenkins fails to clone a remote repo on windows - and the issue is it is passing invalid arguments to git_ssh.


 > git rev-parse --is-inside-work-tree # timeout=10

Fetching changes from the remote Git repository
> git config remote.origin.url git@github.com:jtnord/cjp-champagne-lib.git # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
No valid HEAD. Skipping the resetting
> git clean -fdx # timeout=10
Fetching upstream changes from git@github.com:jtnord/cjp-champagne-lib.git
> git --version # timeout=10
using GIT_SSH to set credentials temp ssh key for jenkins
> git -c core.askpass=true fetch --tags --progress git@github.com:jtnord/cjp-champagne-lib.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@github.com:jtnord/cjp-champagne-lib.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:763)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1012)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$StepRunner.run(AbstractSynchronousNonBlockingStepExecution.java:75)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@github.com:jtnord/cjp-champagne-lib.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: plink: unknown option "-o"
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1388)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:62)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:313)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:761)
... 11 more


jenkins is run from the command line (java -jar .... as it is for testing purposes) on a windows machine.
GIT_SSH is set in the windows environment to GIT_SSH=c:\Program Files (x86)\PuTTY\plink.exe

The checkout is in a workflow which uses credentials (the following step)



checkout([$class: 'GitSCM', branches: [[name: '*/functions_timestamp']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'cjp-champagne-lib']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'github', url: 'git@github.com:jtnord/cjp-champagne-lib.git']]])


environment

```
jenkins 1.609.2

GIT client plugin 1.19.0

GIT plugin 2.4.0
```

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.