一.问题描述
刚开始Git Credentials我采用的是,用户名密码的方式;配置页没有报错,但是jenkins 任务 执行失败,查看console output
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress git@github.com:fanyu-aprivot/AutoTest.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
可见Git Credentials的配置还是有问题。
二.问题解决
改用ssh username private key的方式
1.修改job配置

这个地址可以在GitHub得到:


本文主要描述了在Jenkins中配置Git Credentials时遇到的'fatal: Could not read from remote repository.'错误,并详细介绍了通过切换到SSH认证方式,包括生成SSH密钥对,将公钥添加到GitHub,私钥添加到Jenkins,最终成功解决Git拉取代码问题的过程。
最低0.47元/天 解锁文章
628

被折叠的 条评论
为什么被折叠?



