git存储库在从linux中的jenkins连接时出现403错误 [英] git repository gives 403 error while connecting from jenkins in linux

查看:799
本文介绍了git存储库在从linux中的jenkins连接时出现403错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我只想配置我的项目从github到jenkins来生成构建。
我收到以下错误:

$ p $ 无法连接到存储库:命令/ usr / bin / git ls-远程-h
https://github.com/xxxxx/yyyyy.git HEAD
返回状态码128:
stdout:
stderr:错误:请求的URL返回错误:403禁止,而
访问https://github.com/xxxxx/yyyyy.git/info/refs

致命:HTTP请求失败



我添加了git路径在全局工具配置中也可以。我在linux centos服务器上安装了jenkins。



我在stackoverflow中发现了几个类似的问题,但是没有给出解决方案



任何人都可以告诉我这可能是错误的吗?
在此先感谢

解决方案

尝试创建SSH密钥。这将允许jenkins服务器和Github之间的无密码通信。


$ b 从jenkins服务器(以root身份)运行以下命令:

  sudo su -s / bin / bash jenkins 
cd〜
ssh-keygen -t rsa(点击输入所有提示)
cat .ssh / id_rsa.pub

然后,登录到github用户界面,转到SSH密钥,然后粘贴最后一个命令的输出到一个新的键。



您现在应该很好。


Hi I just want to configure my project from github to jenkins to generate build. I'm getting following error

Failed to connect to repository : Command "/usr/bin/git ls-remote -h 
https://github.com/xxxxx/yyyyy.git HEAD" 
returned status code 128:
stdout: 
stderr: error: The requested URL returned error: 403 Forbidden while 
accessing https://github.com/xxxxx/yyyyy.git/info/refs

fatal: HTTP request failed

I have added git path at Global Tool Configuration also. I've setup jenkins in linux centos server.

I have found few similar questions in stackoverflow but that doesn't give a solution

Can anyone please tell me what may be wrong in that ? Thanks in advance

解决方案

Try creating an SSH Key. This will allow passwordless communication between your jenkins server and Github.

Run the following commands from your jenkins server(as root):

sudo su -s /bin/bash jenkins
cd ~
ssh-keygen -t rsa  (Hit enter for all prompts)
cat .ssh/id_rsa.pub

Then, login to the github UI, go to SSH Keys, then paste the output of the last command into a new key.

You should be good to go at this point.

这篇关于git存储库在从linux中的jenkins连接时出现403错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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