Jenkins到Github与Deploy Key的集成导致访问被拒绝 [英] Jenkins to Github integration with Deploy Key results in an access denied

查看:407
本文介绍了Jenkins到Github与Deploy Key的集成导致访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力将Jenkins集成到我必须提取代码并运行的GitHub存储库中.我已将GitHub存储库URL添加到我设置的Jenkins作业的源代码管理"部分中.我已经进入Jenkins服务器并生成了KeyPair.

I’m working to integrate Jenkins to a GitHub repo that I have to pull code, and run. I’ve add a GitHub repository URL to a Source Code Management section in a Jenkins job that I have set up. I’ve ssh’ed into the Jenkins server and generated a KeyPair.

我已在Deploy Keys下将生成的Public Key添加到GitHub(我也在SSH key下尝试了它),并且我的Jenkins作业仍然显示错误无法连接到存储库:Command''''/opt/{user}/git/bin/git ls-remote -h git@github.com:{project}/{repo} .git HEAD返回状态码128:

I’ve added the generated Public Key to GitHub under the Deploy Keys (I also tried it under SSH key), and my Jenkins job still displays the error "Failed to connect to repository : Command "/opt/{user}/git/bin/git ls-remote -h git@github.com:{project}/{repo}.git HEAD" returned status code 128:

有没有办法解决这个问题?我尝试生成一个新的密钥对,并尝试使用用于访问GitHub存储库的凭据,但是我没有任何运气.

Is there a way to solve this issue? I’ve tried generating a new key pair, and playing around with the credentials used to access the GitHub repo, but I haven’t had any luck.

任何朝着正确方向的帮助将不胜感激!

Any help in the right direction will be greatly appreciated!!

推荐答案

请确保使用这将使您能够在GitHub存储库的ssh URL(Jenkins作业配置页面)下方指示要使用哪个SSH密钥作为凭据.

That will allow you to indicate, below the ssh URL of your GitHub repo (int he Jenkins job configuration page) which SSH key you are using for your credentials.

这篇关于Jenkins到Github与Deploy Key的集成导致访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆