報(bào)錯(cuò)信息:
無(wú)法連接倉(cāng)庫(kù): Command "git ls-remote -h -- git@ip:xxx/xxx.git HEAD"
returned status code 128:
stdout:
stderr: No ED25519 host key is known for <ip> 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 rightsand the repository exists.
問題解釋:
主要是因?yàn)橹鳈C(jī)密鑰驗(yàn)證的問題
解決方法:
方法一:
?打開jenkins系統(tǒng)配置中的全局配置
將Git Host Key Verification Configuration中的Host Key Verification Strategy改為No verification
保存即可
這是通過(guò)將主機(jī)密鑰驗(yàn)證策略改成不用證書驗(yàn)證的模式(注意:在考慮安全性的情況下不要使用這種方法)
方法二:
通過(guò)在jenkins服務(wù)器上配置主機(jī)密鑰驗(yàn)證
步驟:
通過(guò)ssh-keyscan生成gitlab服務(wù)器的主機(jī)密鑰驗(yàn)證,并將這個(gè)文件寫入jenkins配置文件中的known_hosts驗(yàn)證文件里,已達(dá)到驗(yàn)證某個(gè)主機(jī)密鑰驗(yàn)證
jenkins部署在服務(wù)器上
sudo -u jenkins ssh-keyscan -H <Gitlab服務(wù)器ip> >> /var/lib/jenkins/.ssh/known_hosts
jenkins是通過(guò)docker啟動(dòng):文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-841164.html
sudo docker exec -u jenkins <jenkins_container_name> ssh-keyscan -H <Gitlab服務(wù)器ip> >> /var/jenkins_home/.ssh/known_hosts
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-841164.html
到了這里,關(guān)于Jenkins構(gòu)建流水線SSH連接Git錯(cuò)誤:Host key verification failed 報(bào)錯(cuò)問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!