windows - Jenkins 无法在 Windows 上通过 Git/SSH 克隆 Git 存储库

标签 windows git continuous-integration hudson jenkins

我已经在 Windows 2008 32 位上通过 Git/SSH 成功克隆了 Jenkins 中的 Git 存储库。当我尝试在 Windows 2008 64 位上执行相同操作时,控制台输出 页面卡在此处:

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

当我停止构建时(卡在那里几分钟后),我收到了错误消息的其余部分:

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.com/zeljkofilipin/watirbook.git 从两台机器上的 Jenkins 克隆存储库
  • 我可以从两台机器上的命令行通过 Git/SSH URL git@github.com:zeljkofilipin/watirbook.git 克隆
  • 我可以在 32 位机器上通过 Git/SSH URL 从 Jenkins 克隆,但不能在 64 位机器上克隆。

我能注意到的两台机器之间的唯一区别(不算我笔记本电脑上的虚拟机,另一台是瑞士的真机)是第一台是 32 位的,第二台是 64 位的-位。

不确定这是否相关,但 32 位机器的位置设置为克罗地亚,64 位机器的位置设置为瑞士(正如您从法语 Git 输出中看到的那样)。

有关更多信息,请参阅我的博客文章:Jenkins, Windows and Git

最佳答案

最近我经历了这些痛苦。尤其令人沮丧的是在这种情况下缺少错误日志:可能是因为 MSysgit 在尝试恢复时在控制台上提示用户 - 这无法通过 Jenkins 控制台。

根据我的经验,这里有几个需要注意的关键因素:

  1. 安装了 Msysgit 和 Cygwin 的组合:MSysgit 对我来说效果更好——但我假设你也在使用它
  2. 有些人更幸运 <MSYSGIT_ROOT>\cmd\git.cmd<MSYSGIT_ROOT>\bin\git.exe
  3. 确保您的 slave 以同一用户身份运行(这不是基于服务的安装的默认设置).. - 哦,我看到你也明白了
  4. 设置HOME Windows slaves 显式变量
  5. 基本上确保在 Jenkins 下达到相同的 .ssh key 。
  6. 对于调试,我发现创建一个没有 SCM 的测试作业很有用,但运行 git clone在“执行 shell/批处理”构建步骤中。那应该揭示更多信息。顺便说一句,你可以做一个 env在同一步骤中,也许 ls %HOME%/.ssh

我认为以上是让我在 Windows 7 64 位 Jenkins slave 上工作并支持 git 的原因——尽管我认为这与其他一些精细的配置细节有关,而不是 64 位和 32 位。无论如何祝你好运!

关于windows - Jenkins 无法在 Windows 上通过 Git/SSH 克隆 Git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7850395/

相关文章:

c# - 在 WinForms 中调整单个控件的大小

c++ - 在 C++ 中寻找基于 Windows RAM 的共享内存解决方案

python - 如何在 64 位 Windows 上安装 SciPy?

GIT 差异图形用户界面

asp.net-mvc - 如何在没有互联网的情况下在构建服务器/生产服务器上使用 NuGet 包?

python - 我们的开发人员应该如何使用 Jenkins 测试 python SVN 分支?

c# - 从代码调用悬停预览

git - 将 ODP 链接回 NSF -

c# - Git:文件在本地删除但远程更改。我如何看到他们的变化?

node.js - 如何跨平台移动 npm node_modules 文件夹?