简体   繁体   English

Jenkins错误128 / Git错误403:Jenkins无法连接到我的Bitbucket存储库

[英]Jenkins Error 128 / Git Error 403: Jenkins can't connect to my Bitbucket repository

OS: Ubuntu 16.04 操作系统: Ubuntu 16.04

Hypervisor: VirtualBox 系统管理程序: VirtualBox

Network configuration: Nat Network with port forwarding to access the vms through the host ip. 网络配置:具有端口转发功能的Nat网络,可通过主机ip访问vm。 I can also ping a VM from another VM. 我还可以从另一个VM ping一个VM。

I try to connect my Jenkins app hosted on a VM to my BitBucket server also on a VM. 我尝试将VM上托管的Jenkins应用程序连接到VM上的BitBucket服务器。 I followed a tutorial on internet but when i enter the address of my git repository i'm getting this: 我遵循了互联网上的教程,但是当我输入git存储库的地址时,我得到了:

Failed to connect to repository : Command "usr/bin/git ls-remote -h http://admin@192.168.6.102:8005/scm/tes/repository-test.git HEAD" returned status code 128: stdout: stderr: fatal: unable to access 'http://admin@192.168.6.102:8005/scm/tes/repository-test.git/': The requested URL returned error: 403

So, to be sure I tried to exectute the command on the terminal... and on the terminal it seems to work.. I can also push, clone, pull etc.. 因此,请确保我尝试在终端上执行命令...,并且在终端上似乎可以执行..我也可以推,克隆,拉等。

On this image you can see that it's true 在这张图片上,您可以看到它是真的

Do you have an explanation? 你有解释吗?

EDIT: 编辑:

I try some others things like use or not sudo to see if the permissions problem came from that and it seems that it's not the case. 我尝试其他一些事情,例如使用或不使用sudo,以查看权限问题是否是由该问题引起的,似乎并非如此。 But I see that there is no result when we use the "HEAD" argument. 但是我看到使用“ HEAD”参数时没有结果。

Do you think that because "HEAD" give no result, git in jenkins interprets it like no answer and returns the damn** error 403? 您是否认为因为“ HEAD”没有给出结果,因此jenkins中的git将其解释为没有答案并返回该死的**错误403?

EDIT 2: 编辑2:

I found that on the web: http: // jenkins-ci.361315.n4.nabble.com/Jenkins-GIT-ls-remote-error-td4646903.html The guy has the same problem but in a different way, I will try to allocate more RAM to see if it does the trick. 我在网上发现了这个问题:http:// jenkins-ci.361315.n4.nabble.com/Jenkins-GIT-ls-remote-error-td4646903.html这个家伙有同样的问题,但是我会以不同的方式尝试分配更多的RAM,看看是否能解决问题。

There could be many possible problems, but you are getting 403 - Access Forbidden, which indicates some problem with permissions. 可能有很多问题,但是您遇到403-禁止访问,这表明权限存在问题。 I would suggest first common mistakes: 我建议首先犯下的错误:

  • a) trying https instead http - my scm only uses https, a)尝试使用https而不是http-我的scm仅使用https,
  • b) check if admin is correct - scm by default uses scmadmin. b)检查admin是否正确-scm默认情况下使用scmadmin。

Here I run the exact same command twice. 在这里,我两次运行完全相同的命令。

The first time I used the proxy configuration wich I need to access internet, and the second time I set the mandatory server on "none". 第一次使用代理配置需要访问Internet,第二次将强制性服务器设置为“无”。

So there is a problem with the damn proxy. 因此,该死的代理人存在问题。 I was thinking that the proxy was not used in NAT connection with VirtualBox... 我以为该代理未在与VirtualBox的NAT连接中使用...

I found the solution. 我找到了解决方案。

I had to reinstall jenkins to have a user named "jenkins" with his own home directory. 我必须重新安装jenkins才能让一个名为“ jenkins”的用户拥有自己的主目录。

I don't know if it is linked or not, but I configured my bitbucket server to use only HTTPS with a self signed certificate (I work in lan) 我不知道它是否已链接,但是我将我的bitbucket服务器配置为仅使用带有自签名证书的HTTPS(我在lan工作)

My troubleshoot was linked with my proxy settings. 我的疑难解答与我的代理设置相关联。 I disabled all my proxy settings in Linux so I was able to launch the command that did'nt worked in jenkins with terminal. 我禁用了Linux中的所有代理设置,因此能够启动在终端机的jenkins中不起作用的命令。

I logged with sudo su jenkins the commands also worked. 我用sudo su jenkins登录,命令也有效。 I found out that in the home directory of the jenkins user there was a "proxy.xml" file. 我发现在jenkins用户的主目录中有一个“ proxy.xml”文件。 I opened it and saw my old proxy settings. 我打开它,看到了旧的代理设置。 I deleted all the content with vim, saved and restarted and the error was gone. 我用vim删除了所有内容,保存并重新启动,错误消失了。

there can be git version miss match..... I would suggest you update git once. 可能有git版本未命中.....我建议您一次更新git。 maybe it will resolve your issues. 也许它将解决您的问题。

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

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