Jenkins不能在Windows上通过Git / SSH克隆Git存储库 [英] Jenkins can not clone Git repository over Git/SSH on Windows
问题描述
在Windows 2008 32位上,我已经通过Git / SSH在Jenkins中成功克隆了Git存储库。当我尝试在Windows 2008 64位上执行相同操作时,控制台输出页面卡在这里:
I have successfully cloned Git repository in Jenkins over Git/SSH on Windows 2008 32-bit. When I tried to do the same on Windows 2008 64-bit, Console Output page gets stuck here:
Démarré par l'utilisateur anonymous
Checkout:book / C:\Jenkins\workspace\book - hudson.remoting.LocalChannel@1da691a
Using strategy: Default
Last Built Revision: Revision 5d7ce4ae23c91fb201ee005e6db17bcd795ca965 (origin/HEAD, origin/master)
Checkout:book / C:\Jenkins\workspace\book - hudson.remoting.LocalChannel@1da691a
Cloning the remote Git repository
Cloning repository origin
当我停止构建(在几分钟后卡在那里)我得到剩下的错误消息:
When I stop the build (after a few minutes of being stuck there), I get the rest of the error message:
ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:zeljkofilipin/watirbook.git
ERROR: Cause: Error performing command: C:\Git\bin\git.exe clone --progress -o origin git@github.com:zeljkofilipin/watirbook.git C:\Jenkins\workspace\book
null
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1042)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:968)
at hudson.FilePath.act(FilePath.java:785)
at hudson.FilePath.act(FilePath.java:767)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:968)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1193)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:567)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:455)
at hudson.model.Run.run(Run.java:1404)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)
- 我可以通过Git只读URL克隆存储库
git:// github上的git / SSH URL
git @ github。
- 我可以通过Git / SSH URL从Jenkins克隆32位机器,在64位机器上。
- I can clone the repository via Git read-only URL
git://github.com/zeljkofilipin/watirbook.git
from Jenkins on both machines - I can clone via Git/SSH URL
git@github.com:zeljkofilipin/watirbook.git
from the command line on both machines - I can clone via Git/SSH URL from Jenkins on 32-bit machine, but not on 64-bit machine.
- 安装Msysgit和Cygwin的混合:MSysgit更好地为我 -
- 有些人更喜欢
< MSYSGIT_ROOT> \cmd\git.cmd
< MSYSGIT_ROOT> \bin\git.exe
- 确保您的从服务器作为同一用户运行不是默认的基于服务的安装).. - 哦,我看到你也有了
- 设置
HOME
- 基本上可以确保在Jenkins下达到相同的.ssh键。
- 用于调试,我发现创建一个测试作业SCM,但在执行shell /批处理构建步骤中运行
git clone
。这应该揭示一点更多的信息。 BTW,你可以在同一步骤中执行env
,也许ls%HOME%/。ssh
- a mix of both Msysgit and Cygwin installed: MSysgit worked better for me- but I assume you're using that too
- some people have more luck with
<MSYSGIT_ROOT>\cmd\git.cmd
than<MSYSGIT_ROOT>\bin\git.exe
- making sure your slave runs as the same user (which is not the default upon service-based installs).. - oh I see you got that too
- setting
HOME
variable for windows slaves explicity - basically make sure the same .ssh keys are reached when under Jenkins.
- for debugging, I found it useful to create a test job with no SCM, but run
git clone
in an "Execute shell/batch" build step. That should reveal a bit more info. BTW, you can do anenv
in the same step and maybels %HOME%/.ssh
com:zeljkofilipin / watirbook.git 从两台机器上的命令行
我可以注意到两台机器之间的唯一区别(不是一个是我的虚拟机笔记本电脑,另一个是在瑞士的真正的机器)是,第一个是32位,第二个是64位。
The only difference I can notice between the two machines (not counting that one is a virtual machine on my laptop, and another is a real machine in Switzerland) is that the first one is 32-bit and the second one is 64-bit.
不知道是否可以相关,但是32位机器的位置设置为克罗地亚,64位机器到瑞士(从法语Git输出可以看到)。
Not sure if that could be related, but 32-bit machine has location set to Croatia, and 64-bit machine to Switzerland (as you can see from Git output in French).
有关详细信息请参阅我的博文: Jenkins,Windows和Git
For more information please see my blog post: Jenkins, Windows and Git
推荐答案
我最近经历了这些痛苦。特别令人沮丧的是在这种情况下缺少错误日志:可能是因为MSysgit在尝试恢复时提示用户 - 这不能通过Jenkins控制台。
I've gone through these pains recently. Especially frustrating is the lack of error logs in this scenario: probably because MSysgit prompts user on the console when trying to recover - which doesn't get through Jenkins console.
对我的经验这里是几个关键要素:
Based on my experience here are a few key elements to watch for:
我认为上面是给我一个工作的Windows 7 64位Jenkins从服务器与git支持 - 虽然我认为这更多与其他一些精细配置细节比64对32位。祝你好运!
I think the above is what gave me a working a Windows 7 64bit Jenkins slave with git support - although I thought this had more to do with some other fine config detail than with 64 vs 32 bits. Good luck anyhow!
这篇关于Jenkins不能在Windows上通过Git / SSH克隆Git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!