Jenkins构建时报错 ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException

在使用Jenkins和GitLab进行持续集成时遇到Git异常,提示ERROR: Error fetching remote repo 'origin',原因是权限问题。解决方案是将Jenkins服务器的SSH公钥添加到GitLab的SSH Keys中,完成设置后重新构建即可解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Jenkins + GitLab持续集成时遇到如下错误:

ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from ssh://git@gitlab.lucy.com:2222/lucy/test.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)
    at hudson.security.ACL.impersonate(ACL.java:290)<

Fetching upstream changes from git@github. com:a792883583/treeHoleScore.git > /usr/bin/git --version # timeout=10 > git --version # 'git version 1.8.3.1' using GIT _ASKPASS to set credentials github > /usr/bin/git fetch --tags --progress git@github. com:a792883583/treeHoleScore.git +refs/heads/*:refs/remotes/origin/* # timeout=10 ERROR: Error fetching remote repo 'origin' hudson. plugins.git.GitException: Failed to fetch from git@github. com:a792883583/treeHoleScore.git at hudson. plugins . git .GitSCM. fetchFrom(GitSCM. java:1003) at hudson. plugins .git .GitSCM. retrieveChanges(GitSCM. java:1245) at hudson.plugins.git.GitsCM. checkout(GitSCM. java:1309) at hudson.scm. SCM. checkout(SCM. java:540) at hudson. mode1. AbstractProject . checkout(AbstractProject . java:1240) at hudson. model AbstractBuild$AbstractBuildExecution. def aultCheckout (AbstractBuild. java:649) at jenkins .scm. SCMCheckoutStrategy . checkout(SCMCheckoutStrategy . java:85) at hudson . model. AbstractBuild$AbstractBuildExecution. run(AbstractBuild. java:521) at hudson.model . Run. execute(Run. java:1900) at hudson.model. FreeSty1eBuild.run(FreeStyleBuild.java:44) at hudson. model. ResourceController . execute(ResourceController . java:101) at hudson. model. Executor .run(Executor. java:442) Caused by: hudson. plugins.git .GitException: Command "/usr/bin/git fetch --tags --progress git@github . com: a792883583/treeHoleScore.git +refs/heads/* :refs/remotes/origin/*" returned status code 128: stdout: stderr: Host key verification failed. 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 .CliGitAPIImp1.1aunchCommandIn(CliGitAPImp1.java:2734) at org.jenkinsci .plugins.gitclient .CliGitAPIImp1.1aunchCommandWithCredentials(CliGitAPIImpl.java:2111) at org.jenkinsci.plugins . gitclient .CliGitAPIImp1$1. execute(CliGitAPIImp1.java:623) at hudson.p1ugins . git .GitSCM. fetchFrom (GitSCM. java:1001) 11 more ERROR: Error fetching remote repo ' origin' Finished: FAILURE
02-08
Started by user admin Running as SYSTEM Building in workspace /var/lib/jenkins/workspace/mav-test The recommended git tool is: NONE using credential 947311a0-1669-4d11-9146-fbbe7d6a3489 > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/mav-test/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url git@10.0.0.13:gitlab-instance-ea96ef19/mav-test.git # timeout=10 Fetching upstream changes from git@10.0.0.13:gitlab-instance-ea96ef19/mav-test.git > git --version # timeout=10 > git --version # 'git version 1.8.3.1' using GIT_SSH to set credentials Verifying host key using known hosts file > git fetch --tags --progress git@10.0.0.13:gitlab-instance-ea96ef19/mav-test.git +refs/heads/*:refs/remotes/origin/* # timeout=10 ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from git@10.0.0.13:gitlab-instance-ea96ef19/mav-test.git at PluginClassLoader for git//hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997) at PluginClassLoader for git//hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1239) at PluginClassLoader for git//hudson.plugins.git.GitSCM._checkout(GitSCM.java:1310) at PluginClassLoader for git//hudson.plugins.git.GitSCM.checkout(GitSCM.java:1277) at hudson.scm.SCM.checkout(SCM.java:540) at hudson.model.AbstractProject.checkout(AbstractProject.java:1247) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521) at hudson.model.Run.execute(Run.java:1894) at PluginClassLoader for maven-plugin//hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Executor.run(Executor.java:446) Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@10.0.0.13:gitlab-instance-ea96ef19/mav-test.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: No ECDSA host key is known for 10.0.0.13 and you have requested strict checking. Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635) at PluginClassLoader for git//hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:995) ... 12 more ERROR: Error fetching remote repo 'origin' Finished: FAILURE
最新发布
07-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值