jenkins 设置Git sshkey 凭证后,报错:No ECDSA host key is known for

在ManageJenkins->ConfigureGlobalSecurity中,针对GitHostKeyVerificationConfiguration进行设置修改,可消除SSH访问Git时的警告,保存配置即可。

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

如图,设置jenkins通过 ssh key 访问git 地址报错

解决办法 :

打开 Manage jenkins --> Configure Global Security ,找到 Git Host Key Verification Configuration,按下图修改后保存。警告信息可以忽略

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
### 解决 SVN 连接协议错误 当遇到 `No appropriate protocol (protocol is disabled or cipher suites are inappropriate)` 错误时,这意味着在尝试通过 SSL 建立安全连接的过程中出现了问题[^3]。此问题通常是由于客户端和服务器之间支持的 SSL/TLS 版本或加密套件不匹配引起的。 对于 Subversion (SVN),可以通过调整配置来解决问题: #### 修改 TortoiseSVN 设置 如果使用的是 TortoiseSVN 客户端,则可以在设置中执行以下操作以清除凭证并重置连接参数: - 打开 **TortoiseSVN - 导航到 **Saved Data** 部分 - 清除缓存的数据项,特别是认证数据和其他网络相关的存储信息[^5] 这样做有助于移除可能引起冲突的老化证书或过期的安全策略。 #### 更新至最新版本 确保使用的 SVN 客户端和服务端都是最新的稳定版。开发者经常修复各种漏洞以及提升安全性,新版本可能会修正旧版本中存在的某些兼容性问题[^4]。 #### 调整 Java 环境中的算法禁用列表 如果是基于 Java 的环境触发了该异常(例如 Jenkins 中集成 SVN),则应考虑编辑 `$JAVA_HOME/jre/lib/security/java.security` 文件内的 `jdk.tls.disabledAlgorithms` 属性,允许更广泛的 TLS 协议和支持更强力的加密方式。 ```properties # Example entry in java.security file to allow certain protocols and ciphers jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768, EC keySize < 224 ``` 请注意,修改这些设置前应当充分理解其含义,并评估潜在风险;必要时咨询官方文档获取指导。 #### 启用特定TLS版本 有时,默认情况下较高版本的TLS被启用而较低版本未开启,这可能导致部分老旧服务无法正常通信。此时可在命令行工具或其他应用程序启动脚本里指定要使用的最低限度TLS版本号作为临时解决方案。 ```bash export _JAVA_OPTIONS="-Dhttps.protocols=TLSv1,TLSv1.1" ``` 以上措施应该能够帮助缓解大多数因协议不适配而导致的连接失败情况。不过具体情况还需视实际部署场景做相应调整。
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值