简体   繁体   English

Jenkins 无法连接到 github 存储库

[英]Jenkins can't connect to github repo

I have ubuntu 20.04 LTS我有 ubuntu 20.04 LTS
I'm trying to connect my local jenkins to github repo, where is my Jenkinsfile but I'm always getting this error:我正在尝试将我的本地 jenkins 连接到 github 存储库,我的 Jenkinsfile 在哪里,但我总是收到此错误:

Failed to connect to repository: Command "/usr/bin/git ls-remote -h -- https://github.com/RaulMartinezL/almacen_infinito HEAD" returned status code 128: stdout: stderr: remote: Invalid username or password.无法连接到存储库:命令“/usr/bin/git ls-remote -h -- https://github.com/RaulMartinezL/almacen_infinito HEAD”返回状态码 128:stdout:stderr:remote:无效的用户名或密码。 fatal: Authentication failed for ' https://github.com/RaulMartinezL/almacen_infinito/ '致命:' https://github.com/RaulMartinezL/almacen_infinito/ '的身份验证失败

I don't know what is going on because I have exactly the same path '/usr/bin/git' setup on PyCharm and it does work for cloning repositories.我不知道发生了什么,因为我在 PyCharm 上设置了完全相同的路径“/usr/bin/git”,并且它确实适用于克隆存储库。 In fact, it is the same repository.事实上,它是同一个存储库。

Then I check on terminal the path, and I get this:然后我在终端上检查路径,我得到了这个:
bash: cd: usr/bin/git: Not a directory bash:cd:usr/bin/git:不是目录

I have checked this commands too:我也检查了这个命令:

which git:其中 git:
/usr/bin/git /usr/bin/git
type git: git 类型:
git is hashed (/usr/bin/git) git 已散列(/usr/bin/git)

I don't know what is wrong and why the path works on PyCharm and not on Jenkins.我不知道出了什么问题以及为什么该路径适用于 PyCharm 而不是 Jenkins。

the error states username / password error.错误状态用户名/密码错误。

cd: usr/bin/git: Not a directory

correct, because git is executable.正确,因为 git 是可执行的。 not directory.不是目录。

check your username and password.检查您的用户名和密码。


To add a credential, click on “Add” next to “Credentials” -> Select “Jenkins Credential Provider”, this will display the following add credentials screen.要添加凭据,请单击“凭据”旁边的“添加”-> Select“Jenkins 凭据提供程序”,这将显示以下添加凭据屏幕。

在此处输入图像描述

Reference for further information更多信息参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM