Hudson git 克隆错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1177292/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:46:06  来源:igfitidea点击:

Hudson git clone error

githudsonclone

提问by ?eljko Filipin

I have created free-style software project in Hudson.

我在 Hudson 创建了自由风格的软件项目。

I want to clone a public Git repository: git://github.com/bret/watir.git

我想克隆一个公共 Git 存储库:git://github.com/bret/watir.git

Build fails with error message:

构建失败并显示错误消息:

Started by user anonymous
Checkout:workspace / C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace - hudson.remoting.LocalChannel@1a1f370
Last Build : #4
Checkout:workspace / C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace - hudson.remoting.LocalChannel@1a1f370
Cloning the remote Git repository
Cloning repository origin
$ git clone -o origin git://github.com/bret/watir.git "C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace"
Trying next repository
ERROR: Could not clone from a repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
    at hudson.plugins.git.GitSCM.invoke(GitSCM.java:400)
    at hudson.plugins.git.GitSCM.invoke(GitSCM.java:358)
    at hudson.FilePath.act(FilePath.java:676)
    at hudson.FilePath.act(FilePath.java:660)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:358)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:833)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:314)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:266)
    at hudson.model.Run.run(Run.java:948)
    at hudson.model.Build.run(Build.java:112)
    at hudson.model.ResourceController.execute(ResourceController.java:93)
    at hudson.model.Executor.run(Executor.java:118)

I do not think the problem is in folder permissions because I have another Hudson job (with SVN repository) that works just fine.

我不认为问题出在文件夹权限上,因为我有另一个 Hudson 作业(带有 SVN 存储库),效果很好。

I have tried to clone the repository to .hudson\jobs\watir\workspace from command line, and it works fine:

我试图从命令行将存储库克隆到 .hudson\jobs\watir\workspace,它工作正常:

C:\>git clone -o origin git://github.com/bret/watir.git "C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace"
Initialized empty Git repository in C:/Documents and Settings/Administrator/.hudson/jobs/watir/workspace/.git/
remote: Counting objects: 15203, done.
essing objects: 100% (5307/5307), done.
remote: Total 15203 (delta 10052), reused 14532 (delta 9565)
Receiving objects: 100% (15203/15203), 7.88 MiB | 144 KiB/s, done.
Resolving deltas: 100% (10052/10052), done.

As far as I can tell, Hudson used either the same Git executable or the same version of it, as command line does.

据我所知,Hudson 使用了相同的 Git 可执行文件或它的相同版本,就像命令行一样。

Command line:

命令行:

C:\>git version
git version 1.6.3.2.1299.gee46c

Hudson:

哈德森:

Started by user anonymous
[workspace] $ cmd /c call C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\hudson9062544454093366628.bat

C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace>git version
git version 1.6.3.2.1299.gee46c
Finished: SUCCESS

Searching the web I have found only one page related to my error message (hudson git plugin remote windows slave clone), and it says that the problem is Git not being in path. But in that case, git versionwould not run from Hudson, right?

在网上搜索我只找到了一个与我的错误消息相关的页面(hudson git plugin remote windows slave clone),它说问题是 Git 不在路径中。但那样的话,git version就不会跑掉哈德逊了吧?

Environment:

环境:

  • Microsoft Windows Server 2003 R2, Standard Edition, Service Pack 2
  • java 1.6.0_14
  • Hudson 1.316
  • Hudson GIT plugin 0.7.3
  • git 1.6.3.2.1299.gee46c
  • Microsoft Windows Server 2003 R2,标准版,Service Pack 2
  • java 1.6.0_14
  • 哈德逊 1.316
  • 哈德森 GIT 插件 0.7.3
  • git 1.6.3.2.1299.gee46c

采纳答案by ?eljko Filipin

Looks like hudson git plugin remote windows slave clonepost was right. When I go to Manage Hudson > Configure System, in Git > Git executablesection, there is error There's no such executable git in PATH. (If takes a few seconds for Hudson to display the error after the page is displayed.) Adding C:\Program Files\Git\binto path and restarting Hudson solved the problem.

看起来hudson git plugin remote windows slave clonepost 是正确的。当我去管理哈德森>配置系统,在Git > Git executable部分中有一个错误There's no such executable git in PATH。(如果显示页面后 Hudson 显示错误需要几秒钟。)添加C:\Program Files\Git\bin到路径并重新启动 Hudson 解决了问题。

回答by Guildencrantz

It's worth noting that if the cloning process itself has an issue you will also see this problem. I have had issues with one of my boxes failing 4 out of 5 times on the initial clone of a large repository, and hudson kept throwing this error. A good way to verify this is the problem, and it's not Hudson being unable to find the git executable, is to clone the repository into the Hudson workspace manually, and then run a Hudson build: if Hudson is configured properly the build will succeed and report that there are no changes.

值得注意的是,如果克隆过程本身有问题,您也会看到这个问题。在对大型存储库进行初始克隆时,我的一个机器出现了 5 次中有 4 次失败的问题,而 hudson 一直在抛出此错误。验证这是问题的一个好方法,并不是 Hudson 无法找到 git 可执行文件,而是手动将存储库克隆到 Hudson 工作区,然后运行 ​​Hudson 构建:如果 Hudson 配置正确,构建将成功并且报告说没有变化。

回答by csomakk

I needed to try with the ssh [email protected]:organisation/repo.giturl instead the https https://github.company.co.uk/organisation/repo.git

我需要尝试使用 ssh [email protected]:organisation/repo.giturl 而不是 httpshttps://github.company.co.uk/organisation/repo.git

回答by mkato

Git plugin 0.7.3 have some issues when used with windows absolute paths.

Git 插件 0.7.3 在与 Windows 绝对路径一起使用时存在一些问题。

Try using relative paths instead.

尝试改用相对路径。