简体   繁体   English

git clone在Mac OS X上的Hudson上失败

[英]git clone fails on Hudson on Mac OS X

I am using Hudson with git plugin on Mac OS X. My git repository is on my own server and is accessible with SSH. 我在Mac OS X上将Hudson与git插件一起使用。我的git存储库位于我自己的服务器上,可通过SSH访问。 I have keys configured properly. 我的键配置正确。 I am starting Hudson from command line using the default Winstone server. 我正在使用默认的Winstone服务器从命令行启动Hudson。 Cloning from command line works and everything worked very well from Hudson before one day I wanted to force Hudson to clear the repository before the build. 从命令行进行克隆工作之后,从Hudson进行的所有工作都非常顺利,有一天,我想强迫Hudson在构建之前清除存储库。 And so I checked the Clean workspace before build in the Advanced Project Options group. 因此,我在“ 高级项目选项”组中检查了“ 清理”工作区,然后再进行构建 From now on, every single build fails with the following message: 从现在开始,每个单独的构建都会失败,并显示以下消息:

Started by user anonymous
Cleaning the workspace because project is configured to clean the workspace before each build.
Checkout:workspace / /Users/mczenko/.hudson/jobs/My Project/workspace - hudson.remoting.LocalChannel@592e4ff9
Using strategy: Default
Last Built Revision: Revision fc233689562bf464b08d7406a382d4bee0209c04 (origin/master)
Checkout:workspace / /Users/user/.hudson/jobs/My Project/workspace - hudson.remoting.LocalChannel@592e4ff9
Cloning the remote Git repository
Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone git@myserver.com:git/MyProject.git
ERROR: Cause: Exception caught during execution of fetch command
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
    at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:913)
    at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:845)
    at hudson.FilePath.act(FilePath.java:758)
    at hudson.FilePath.act(FilePath.java:740)
    at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:845)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:622)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1483)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:507)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:424)
    at hudson.model.Run.run(Run.java:1366)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:145)

Initially I thought something is wrong with my ssh configuration and that maybe there is something specific to my server installation. 最初,我认为ssh配置有问题,并且也许我的服务器安装存在某些问题。 But then I checked the same with one of my GitHub repositories and the problems persists. 但是随后我使用我的GitHub存储库之一进行了检查,问题仍然存在。 There are many similar questions related to this problem, most of them referring to configuration of ssh - which turns out to be done correctly on my system. 有许多与此问题相关的类似问题,其中大多数是关于ssh的配置的-事实证明,这是在我的系统上正确完成的。 I also found the message at http://wiki.hudson-ci.org/display/HUDSON/Git+Plugin suggesting that this failure may be caused by a problem with the path to the git executable. 我还在http://wiki.hudson-ci.org/display/HUDSON/Git+Plugin上找到了该消息,提示此故障可能是由于git可执行文件的路径问题引起的。 I checked that of course and as expected it makes no difference on my system. 我当然检查了一下,并按预期对我的系统没有影响。 Even closer problem is reported here: Hudson git clone error where Rob Segal says: 这里甚至报告了更接近的问题: Hudson git clone错误 ,Rob Segal说:

This is exactly the problem I have been running into. 这正是我一直遇到的问题。 If I do a clone on command line first into the workspace where hudson will be working future builds work fine. 如果我首先在命令行上进行克隆,然后进入hudson将要工作的工作区,则以后的构建工作会很好。 Something is clearly going on wrong with the initial cloning process but I can't say what exactly at this point. 最初的克隆过程显然出了点问题,但是我现在不能确切地说出什么。 No doubt debugging the Git plugin code could reveal exactly what is wrong. 毫无疑问,调试Git插件代码可以准确地揭示出什么地方出了问题。 If I ever get some free time I plan to do this. 如果我有空闲时间,我打算这样做。

I haven't found so far any reference to the situation I have, where the failure in clone seems to be correlated with enabling Clean workspace before build option. 到目前为止,我还没有找到我所遇到的情况的参考,克隆中的失败似乎与启用在生成选项之前清理工作区有关

Git plugin has its own option Wipe out workspace before build , which seems to have the same function as the Clean workspace before build option mentioned above. Git插件有其自己的选项构建之前擦除工作空间 ,该功能似乎与上面提到的构建之前清理工作空间功能相同。 It has the same effect on cloning: after enabling it, cloning fails with the message above. 它对克隆具有相同的作用:启用它后,克隆失败并显示上述消息。

Once I noticed the problem, the work around seems to be not to use the Clean workspace before build option and not to use git plugin for fresh builds (and doing git clone in the build step), but I am not sure if this is really the problem. 一旦发现问题,解决方法似乎是不使用“ 在构建之前先清理工作区”选项,而不是对新构建不使用git插件(并在构建步骤中执行git clone),但是我不确定这是否真的问题。 Maybe someone has the same problem and can point out some solution. 也许有人遇到同样的问题,可以指出一些解决方案。

Remember that the hudson/jenkins user will be making the clone request. 请记住,hudson / jenkins用户将发出克隆请求。 You'll need to have configured an ssh key for the user running hudson, and given that user read access to the repository. 您需要为运行hudson的用户配置ssh密钥,并赋予该用户对存储库的读取权限。

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

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