当前位置: 首页 > 面试题库 >

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

孟华晖
2023-03-14
问题内容

我正在尝试使用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

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

如果是,该如何预防?

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


问题答案:

原来这是一个代理问题。

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

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



 类似资料:
  • 问题内容: 当我在Jenkins下的Git中提供本地存储库路径时,我收到错误消息: 如何解决此问题? 问题答案: 您需要确定(默认情况下未定义)指的是什么(在启动Jenkins之前): 可能不是一条可访问的路径。 如本博客文章所述: 创建一个新的Execute Shell构建步骤。执行命令: 运行构建并检查输出以查看位置

  • 问题内容: 我正在尝试在github仓库上连接詹金斯。 当我指定Repo URL jenkins时,返回以下错误消息: 无法连接到存储库:命令“ git ls-remote -h git@github.com:adolfosrs / jenkins-test.git HEAD”返回状态码128:stdout:stderr:主机密钥验证失败。致命:无法从远程存储库读取。请确保您具有正确的访问权限,并

  • 问题内容: 在“源代码管理”部分中设置git config时遇到此错误,存储库网址是私有的,而不是来自github 我尝试在jenkins凭证提供程序中设置用户名和密码,但仍然无法正常工作。 我在终端中为该项目所做的克隆就是这样的,要求提供密码后就可以使用了 我认为他以某种错误的方式输入了用户名/通行证,有人对此有想法吗? 问题答案: 类似scp的ssh URL 意味着运行Jenkins的帐户将查

  • 问题内容: 我也是Jenkins和git的新手。我在创建了一个远程存储库并对其进行了本地复制。 然后,我想通过詹金斯链接它。我安装了git集成所需的插件,但是在配置新项目时,我不知道要在本地Repository URL中设置什么。有人可以帮我在哪里找到它吗? 问题答案: 在这种情况下,URL应该以文件协议开头,然后是存储库的路径。例如。

  • 问题内容: 我已经通过Windows 2008 32位上的Git / SSH在Jenkins中成功克隆了Git存储库。当我尝试在64位Windows 2008上执行相同操作时, 控制台输出 页面卡在此处: 当我停止构建时(在卡住了几分钟之后),我得到了其余的错误消息: 我可以通过两台机器上的Jenkins 通过Git只读URL克隆存储库 我可以从两台计算机上的命令行通过Git / SSH URL进

  • 问题内容: 我使用的是詹金斯(Jenkins)的Git插件,也使用道格拉斯·克莱格(Douglas Creager)的get_git_version 脚本。这使用git describe来为python模块获取一些明智的版本。通常,这会创建类似的东西,但是在詹金斯身上,我得到: 我已配置插件不通过“跳过内部标签”提供自己的标签。 像在这个有关从jenkins推送的问题中那样,对master分支进行