git - Git克隆不一致的身份验证失败,詹金斯管道中的ssh密钥
问题描述
我的詹金斯管道中有一个奇怪的行为。
当我有一个使用 ssh 密钥(在 Windows 从属设备上)执行 git clone 的阶段时,该阶段在 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'
那么你知道问题出在哪里吗?
在此先感谢您的帮助 ;)
解决方案
推荐阅读
- javascript - 如何获得另一个属性等于 x 的属性值?
- laravel - 使用 SSH 将文件从远程服务器复制到本地服务器
- python - rabbitmq 是如何同步消息的?
- c# - C# .NET 后台服务
- jquery - 获取画布 ID“OnClick”
- javascript - JS - default() 不是函数
- android - 如何在主题中设置图像样式。安卓?
- java - 泛型的 Spring 嵌套自动装配抛出 NoUniqueBeanDefinitionException
- python - 我们的预测模型如何处理未缩放的新传入 Unseen 数据,既没有热编码也没有 PCA 尚未完成?
- uwp - 如何让 UWP ContentDialog 的 SecondaryButton 设置焦点?