为什么Jenkins中的GIT插件无法连接到GIT存储库? [英] Why GIT Plugin in Jenkins is not able to connect to the GIT Repository?

查看:195
本文介绍了为什么Jenkins中的GIT插件无法连接到GIT存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用GIT Plugin Jenkins将GIT代码格式化,并且该作业正在从机器上运行。

MASTER

code>系统有 http_proxy = mycom.domain.com:80



SLAVE 系统没有定义 http_proxy

每当我做git克隆本地在 SLAVE 机器上完美运行,但是从Jenkins我没有成功。



它是抛出以下错误:

 在工作区/数据/测试中的SLAVE上远程构建
> / usr / bin / git rev-parse --is-inside-work-tree#timeout = 10
从远程Git存储库获取更改
> / usr / bin / git config remote.origin.url https://github.domain.com/Project-Digital/Project-eCommerce.git#timeout = 10
从https://github.domain获取上游更改.com / Project-Digital / Project-eCommerce.git
> / usr / bin / git --version#timeout = 10
使用GIT_ASKPASS设置凭证
设置http代理:mycom.domain.com:80
> / usr / bin / git fetch --tags --progress https://github.domain.com/Project-Digital/Project-eCommerce.git + refs / heads / *:refs / remotes / origin / *
错误:错误获取远程回购起源
hudson.plugins.git.GitException:无法从哈德森https://github.domain.com/Project-Digital/Project-eCommerce.git
获取.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
在hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
在hudson.plugins.git.GitSCM.checkout (GitSCM.java:1094)
在hudson.scm.SCM.checkout(SCM.java:495)
在hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
。在hudson.model.AbstractBuild $ AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
在jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
在hudson.model.AbstractBuild $ AbstractBuildExecution.run( AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyl eBuild.run(FreeStyleBuild.java:43)
在hudson.model.ResourceController.execute(ResourceController.java:98)
在hudson.model.Executor.run(Executor.java:404)$ B hudson.plugins.git.GitException:$ b所致命令的/ usr / bin中/混帐取--tags --progress https://github.domain.com/Project-Digital/Project-eCommerce.git +裁判/头/ *:refs / remotes / origin / *返回状态码128:
stdout:
stderr:错误:连接到github.build.ge.com:80失败:正在访问https://github.domain.com/Project-Digital/Project-eCommerce.git/info/refs

是因为 MASTER 系统尝试设置 SLAVE

或者,还有其他我缺少的东西吗?

p>

解决方案

原来这是一个代理问题。



从使用Jenkins的GIT开始,它将 http_proxy 设置为 mycom.domain.com:80 MASTER 机器代理),并且此代理在 SLAVE 机器中不是必需的。



因此,我只是将GIT URL添加到No Proxy Host部分(管理Jenkins - >管理插件 - >高级 - > HTTP代理配置 - >在无代理主机字段中添加了GIT URL) / code>在詹金斯,现在它工作正常。


I am trying to pull the code form GIT using GIT Plugin Jenkins and the job is running on a slave machine.

MASTER system has http_proxy=mycom.domain.com:80

and in SLAVE system there is no http_proxy defined.

Whenever I am doing git clone locally in the SLAVE machine it works perfectly, however from Jenkins I haven't been successful.

It is throwing the following error:

Building remotely on SLAVE in workspace /data/test
 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > /usr/bin/git config remote.origin.url https://github.domain.com/Project-Digital/Project-eCommerce.git # timeout=10
Fetching upstream changes from https://github.domain.com/Project-Digital/Project-eCommerce.git
 > /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
Setting http proxy: mycom.domain.com:80
 > /usr/bin/git fetch --tags --progress https://github.domain.com/Project-Digital/Project-eCommerce.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.domain.com/Project-Digital/Project-eCommerce.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
    at hudson.scm.SCM.checkout(SCM.java:495)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1728)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:404)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://github.domain.com/Project-Digital/Project-eCommerce.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: error: Failed connect to github.build.ge.com:80; Operation now in progress while accessing https://github.domain.com/Project-Digital/Project-eCommerce.git/info/refs

Is it because the MASTER system trying to set http proxy which is not present in the SLAVE system?

If yes, how to prevent it?

Or, is there something else I am missing?

解决方案

Turned out it was a proxy issue.

While pulling the code from GIT using Jenkins it was setting the http_proxy to mycom.domain.com:80 (MASTER machine proxy) and this proxy was not required in the SLAVE machine.

So, I just added the GIT URL to No Proxy Host section (Manage Jenkins -> Manage Plugins -> Advanced -> HTTP Proxy Configuration -> Added GIT URL in No Proxy Host field) in Jenkins and now it is working fine.

这篇关于为什么Jenkins中的GIT插件无法连接到GIT存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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