詹金斯与Tomcat - 无法连接到存储库:无法初始化 [英] Jenkins with Tomcat - Failed to connect to repository : Could not init

查看:92
本文介绍了詹金斯与Tomcat - 无法连接到存储库:无法初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:




  • 我已经安装 Jenkins v1.605 Windows 7 SP1 x64 后面加载了 Apache Tomcat 7.0.59 $ c>公司代理

  • 我在Jenkins中配置了JDK,Git和maven安装路径。在管理插件的高级选项卡下配置代理
  • 我在Eclipse上有一个Java项目,它托管在 Bitbucket repository使用EGit插件,我试图通过https将它连接到Jenkins。


  • 我在Jenkins创建了一个新工作,仓库URL(https://@bitbucket.org//.g​​it),并在下一步添加我的凭据。这是我得到以下错误的地方:

    $ b 无法连接到存储库:无法init D:\Work\apache-tomcat-7.0.59\temp\hudson4595160075978517187tmp



    我试过了:

    我在过去两天里检查了大约20个SO问题和很多其他网站,并实施了其他有用的解决方案,但无济于事。以下是我试过的:



    任何人都可以告诉我,如果我在这里错过了什么吗?我应该在代理后面执行其他一些步骤吗?或者是其他问题?



    这是我第一次进入CI,所以请原谅我,如果我听起来像一个noob。

    解决方案

    我遇到了这个问题,并使用Process Monitor调查了服务器上发生了什么。我发现这个特定的错误,帮助找出问题:

      java.exe CreateFile C:\ Users \ ... \\ \\AppData\Local\GitHub\PortableGit_blabla\cmd init C:\ Users \ ... \AppData\Local\Temp\hudsonblablatmp NAME INVALID 

    cmd 窗口中复制和粘贴命令会出现 C:\ ...不被识别为内部或外部命令... 错误。



    Jenkins正在尝试在临时文件夹中执行 git init 命令。但我注意到服务器上有问题的命令中的 init 选项前没有git可执行文件,这使我转向 Git路径可执行设置在Jenkins的配置中。我将它配置为如上所示( C:\ ... \cmd ),但将其视为简单路径(即文件夹链),并未将其指定为可执行文件。原来Jenkins只是获得了这个价值,并将其用作可执行文件的绝对路径。所以我通过追加 \git.exe 来解决这个问题,并且认为!

    tl; dr



    确保Jenkins配置中的 Git可执行文件路径是可执行文件的绝对路径, / strong>路径中的可执行文件:



    例如 c:\ Users \User\AppData\Local\GitHub\PortableGit_< guid> \cmd\git.exe


    Issue:

    • I have setup Jenkins v1.605 hosted with Apache Tomcat 7.0.59 on Windows 7 SP1 x64 behind a corporate proxy

    • I configured JDK, Git and maven installation paths in Jenkins. Also configured the proxy under the Advanced tab in Manage Plugins

    • I have a Java project on Eclipse that I have hosted on a Bitbucket repository using the EGit plugin and I am trying to connect it to Jenkins over https

    • I created a new job in Jenkins, added the repository URL (https://@bitbucket.org//.git) and added my credentials in the next step. This is where I get the following error:

    Failed to connect to repository : Could not init D:\Work\apache-tomcat-7.0.59\temp\hudson4595160075978517187tmp

    What I have tried:

    I have checked ~20 SO questions and a lot of other websites in the last two days and implemented solutions others found helpful, but to no avail. Here's what I've tried:

    • Tried to clone the repository from Git Bash after configuring the http/https proxy in git (from this answer and this issue). The repository was cloned successfully, but Jenkins was not able to connect to it.

    • Double-checked the git installation path configuration in Jenkins (this and many other answers)

    • I downgraded the git and git client plugins from the latest versions to 1.5.0 and 1.0.7 respectively (from this and many other answers). After this, I entered the URL with my credentials (this answer), but got the same result. After this, I reverted to the latest versions.

    • I tried connecting to a GitHub repository, but faced the same issue

    • Tried to enter the repo URL in various formats (this and this answers)

    • I cleared the Tomcat temp folder and relaunched Jenkins with Tomcat (this answer), but it did not solve the issue

    Can anyone please tell me if I'm missing something here? Should I perform some other steps while working behind a proxy? Or is it some other issue?

    This is my first foray into CI so please forgive me if I sound like a noob.

    解决方案

    I had this problem and investigated what's happening on the server using Process Monitor. I found this particular error which helped pinpoint the issue:

    java.exe  CreateFile  C:\Users\...\AppData\Local\GitHub\PortableGit_blabla\cmd init C:\Users\...\AppData\Local\Temp\hudsonblablatmp NAME INVALID
    

    Copying and pasting the command in a cmd window comes up with the C:\... is not recognized as an internal or external command... error.

    What happens is that Jenkins is trying to execute the git init command in a temporary folder. But I noticed that there is no git executable in front of the init option in the problematic command on the server, which turns me to the Path to Git executable setting in Jenkins' configuration. I had configured it as is looks above (C:\...\cmd) but treated it as a simple path (i.e. chain of folders) and not specified the executable. Turns out that Jenkins is just getting that value and uses it as an absolute path to an executable. So I fixed that by appending \git.exe to it and voilà!

    tl;dr

    Make sure that the Path to Git executable in Jenkins' configurations is the absolute path to the executable, with the executable present in the path:

    e.g. c:\Users\User\AppData\Local\GitHub\PortableGit_<guid>\cmd\git.exe

    这篇关于詹金斯与Tomcat - 无法连接到存储库:无法初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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