jenkins配置Git Credentials时报错fatal: Could not read from remote repository.

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

一.问题描述

刚开始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得到:
在这里插入图片描述

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值