Git克隆不一致身份验证失败,jenkins管道中存在ssh密钥

Git克隆不一致身份验证失败,jenkins管道中存在ssh密钥,git,jenkins,jenkins-pipeline,Git,Jenkins,Jenkins Pipeline,我在詹金斯的管道里有一种奇怪的行为 当我有一个使用ssh密钥执行git克隆的阶段(在windows slave上)时,该阶段在75%的情况下失败。所以有时候它起作用,有时候不起作用 stage('Checkout Application') { dir(sourceExecutablePath) { git branch: "test2", url: "git@gitmaster.ert.com:app/myapp.git", creden

我在詹金斯的管道里有一种奇怪的行为

当我有一个使用ssh密钥执行git克隆的阶段(在windows slave上)时,该阶段在75%的情况下失败。所以有时候它起作用,有时候不起作用

stage('Checkout Application') {
            dir(sourceExecutablePath) {
                git branch: "test2", url: "git@gitmaster.ert.com:app/myapp.git", credentialsId: '9083fff7-1770-48ae-986c-4b383fez5fd93'
            }
        }
错误堆栈为

using credential 9083fff7-1770-48ae-986c-4b38dfed5fd93
Cloning the remote Git repository
Cloning repository git@gitmaster.ert.com:app/myapp.git
 > git init E:\nosave\jenkins_home\workspace\test\ # timeout=10
Fetching upstream changes from git@gitmaster.ert.com:app/myapp.git
 > git --version # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress git@gitmaster.ert.com:app/myapp.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: kex_exchange_identification: Connection closed by remote host
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:2099)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1791)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:79)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:472)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:685)
    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(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
    at java.lang.Thread.run(Thread.java:834)
    Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from JENKINSSLAVE2.com/10.85.130.3:52657
        at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
        at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
        at hudson.remoting.Channel.call(Channel.java:957)
        at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
        at sun.reflect.GeneratedMethodAccessor909.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.$Proxy102.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:124)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
        at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
        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)
using GIT_SSH to set credentials Gitlab SSH RSA key
 > git fetch --tags --force --progress git@gitmaster.ert.com:app/myapp.git +refs/heads/*:refs/remotes/origin/*
Error cloning remote repo 'origin'
那么你知道问题出在哪里吗


提前感谢您的帮助;)

这是一个SSH级别的问题,可能有许多原因。一个是SSH服务器可能有太多来自新连接的负载,超过了服务器端配置的
MaxStartups
选项。无论如何,这很可能不是客户端/Jenkins端的问题。好的,我已经检查了sshd日志,但我没有看到任何关于这方面的日志。你知道我在哪里可以检查问题是否来自这里吗?此外,我还增加了
MaxStartups
MaxSessions
以防万一。我会检查这个问题是否像那样解决;)这是一个SSH级别的问题,可能有许多原因。一个是SSH服务器可能有太多来自新连接的负载,超过了服务器端配置的
MaxStartups
选项。无论如何,这很可能不是客户端/Jenkins端的问题。好的,我已经检查了sshd日志,但我没有看到任何关于这方面的日志。你知道我在哪里可以检查问题是否来自这里吗?此外,我还增加了
MaxStartups
MaxSessions
以防万一。我会检查这个问题是否像那样解决;)