Jenkins选择了错误的git二进制文件

时间:2019-01-31 13:07:56

标签: git jenkins server jenkins-plugins

我有一个运行在Oracle Linux 2.150.2上的Jenkins服务器(版本6.9)。 Git 1.7.1安装在服务器上,二进制文件位于/usr/bin/git下(运行which git命令时显示)。

我的Windows从属服务器已连接到该主服务器,并且git也在此处配置。仍然出现以下错误:

Caused by: java.io.IOException: Cannot run program "/usr/bin/git" (in directory "C:\Jenkins\workspace\x\y\z"): CreateProcess error=2, The system cannot find the file specified

尝试升级所有插件,然后重新启动Jenkins无效。

以某种方式,Jenkins git插件选择了服务器git路径而不是节点。从控制台日志中可以明显看出这一点:

...
15:17:07 Cloning the remote Git repository
15:17:08 Cloning repository xxx
15:17:09  > /usr/bin/git init C:\Jenkins\workspace\TestJobs\xxx\xxx # timeout=10
...

我的Jenkins Git配置:

    Tool Locations下提到的
  • 节点(Windows)

enter image description here

    Global Tool Configuration下提到的
  • 服务器(Linux)

enter image description here

2 个答案:

答案 0 :(得分:0)

您需要在管理Jenkins -> 管理节点-> YOUR_NODE_NAME -> 配置中配置Git工具。 >页面。在Node Properties部分中,您必须启用Tool Locations,然后添加Git工具位置(您需要为安装在节点上的Git指定Home)。

答案 1 :(得分:0)

我通过在“全局工具配置”和节点的“工具位置”中为Git安装选择相同的名称来解决了同一问题

Jenkins主全局工具配置

Git name in master

节点工具位置

Git name in node

很奇怪,但是有效