为什么Jenkins中的GIT插件无法连接到GIT存储库?

ANI*_*NIL 6 git github jenkins devops

我试图使用GIT插件Jenkins从GIT中获取代码,并且该作业正在从属机器上运行.

MASTER 系统有 http_proxy=mycom.domain.com:80

SLAVE系统中没有http_proxy定义.

每当我在SLAVE机器中进行本地git clone时它都能很好地工作,但是从Jenkins我没有成功.

它抛出以下错误:

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

是因为MASTER系统试图设置系统中不存在的http代理SLAVE吗?

如果是,如何预防呢?

或者,还有其他我想念的东西?

ANI*_*NIL 1

原来是代理问题。

当使用 Jenkins 从 GIT 提取代码时,它设置为http_proxymycom.domain.com:80机器MASTER代理),并且机器中不需要该代理SLAVE

因此,我刚刚将 GIT URL 添加到(Manage Jenkins -> Manage Plugins -> Advanced -> HTTP Proxy Configuration -> Added GIT URL in No Proxy Host field)Jenkins 中的“无代理主机”部分,现在它工作正常。