Jenkins Windows Slave GIT_SSH Invalid format

537 views
Skip to first unread message

jvenk...@gmail.com

unread,
Apr 10, 2019, 9:47:33 AM4/10/19
to Jenkins Users
Hello Users,

I have Jenkins with master slave configuration, I have linux slaves and windows slaves
I am unable to use the Gitlab  SSH credentials on Windows Slave
Fails on scm checkout, The scm checkout works fine for the linux slaves 
To test the id_rsa key, I put the id_rsa in .ssh of home directory  and do git clone, it works fine, but somehow from git credentials it seem to have a problem
Is there a workaround for this issue any help is very much appreciated

using credential 2090ffbd-ddc3-45a9-adfb-e9c0e5ca4c75
Wiping out workspace first.
Cloning the remote Git repository
Cloning repository ssh://g...@gitlab-xxxx.com/xx.git
 > git init E:\workspace\Main_Build_master-HAJ7MPMVYIUEWROZ6RHLXJYVT3JUCE7ZDT7PHAOWUKJQYMDSW5KQ # timeout=10
Fetching upstream changes from ssh://g...@gitlab-xxxx.com/xx.git
 > git --version # timeout=10
using GIT_SSH to set credentials Jenkins private ssh key
 > git fetch --tags --progress ssh://g...@gitlab-xxxx.com/xx.git +refs/heads/*:refs/remotes/origin/* # timeout=7
ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Command "git fetch --tags --progress ssh://g...@gitlab-xxxx.com/xx.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: stderr: Load key "E:\\workspace\\Main_Build_master-HAJ7MPMVYIUEWROZ6RHLXJYVT3JUCE7ZDT7PHAOWUKJQYMDSW5KQ@tmp\\ssh8872120221702825356.key": invalid format Permission denied, please try again. Permission denied, please try again. g...@gitlab-xxxx.com/xx.git: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
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:2002) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1721) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:614) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146) at hudson.remoting.UserRequest.perform(UserRequest.java:212) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:369) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93) at java.lang.Thread.run(Unknown Source) Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.171.1.123/10.171.1.123:1035 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357) at hudson.remoting.Channel.call(Channel.java:955) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146) at sun.reflect.GeneratedMethodAccessor280.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132) at com.sun.proxy.$Proxy94.execute(Unknown Source) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)








Mark Waite

unread,
Apr 10, 2019, 3:43:45 PM4/10/19
to Jenkins Users
Compare the contents of the private key definition in the Jenkins credentials UI with the private key that is being used on the Windows agent.  If the key is incorrectly defined in the Jenkins credentials, that might cause the problem you're seeing.

Move (or hide) all other private keys on the Windows agent to be sure that your successful interactive test was not using a different private key than the private key used in the Jenkins credential.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8c3b499c-73fa-42f6-bd13-5fdac28ef320%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Venkatapathi Jaligama

unread,
Apr 10, 2019, 5:23:18 PM4/10/19
to jenkins...@googlegroups.com
Hello Mark,
Thank you for you prompt response, I have already tested this scenario also removed all the jeys from windows slave and only use the jenkins credentials still does not work, I generated new keys and added the private key in the jenkins credentials and public key in Gitlab still same issue. Could you think of anything else.

Thanks,
Venkat

Mark Waite

unread,
Apr 10, 2019, 5:39:00 PM4/10/19
to Jenkins Users
I've seen problems in the past where I needed to generate the private key / public key pair on the machine that would be using the key.  When you created the private key, did you run ssh-keygen on the Windows computer that is using the key?  If not, you might try that.


For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Venkatapathi Jaligama

unread,
Apr 10, 2019, 5:43:46 PM4/10/19
to jenkins...@googlegroups.com
Hello Mark,

First time i created key on linux, second-time I created on windows slave from putty gen and convert to openssh format and then use the keys, even these keys work for linux slaves but not for windows slave, gives invalid format

Mark Waite

unread,
Apr 10, 2019, 5:54:15 PM4/10/19
to Jenkins Users
I'd create the keys on Windows using the ssh-keygen command on Windows.  OpenSSH on Windows will be consuming the keys.


For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Venkatapathi Jaligama

unread,
Apr 10, 2019, 10:59:39 PM4/10/19
to jenkins...@googlegroups.com
created ssh keys using ssh-keygen from git bash on windows, it works, Thank you very much Mark

Regards,
Venkat

Reply all
Reply to author
Forward
0 new messages