从linux中的jenkins连接时,git repository出现403错误

Sre*_*ree 7 git centos build github jenkins

嗨,我只想将我的项目从github配置为jenkins以生成构建.我收到了以下错误

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
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我也在Global Tool Configuration中添加了git路径.我在linux centos服务器上安装了jenkins.

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

谁能告诉我这可能有什么问题?提前致谢

ped*_*ofb 5

有点晚了,但这个解决方案对我有用。只需将 URL 更改为

 https://github.com/xxxxx/yyyyy.git
Run Code Online (Sandbox Code Playgroud)

 https://youruser@github.com/xxxxx/yyyyy.git
Run Code Online (Sandbox Code Playgroud)


gri*_*edj 1

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

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

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

然后,登录 github UI,转到 SSH Keys,然后将最后一个命令的输出粘贴到新密钥中。

此时您应该可以走了。