我有一个运行在 Oracle Linux 6.9
上的 Jenkins 服务器(版本 2.150.2
)。 Git 1.7.1
安装在服务器上,二进制文件位于 /usr/bin/git
下(运行 which git
命令时显示)。
我的 Windows slave 连接到这个 master,这里也配置了 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 配置:
- Node (Windows)
Tool Locations
下提到的 Git:
- Server (Linux)
Global Tool Configuration
下提到的 Git:
最佳答案
需要在Manage Jenkins -> Manage Nodes -> YOUR_NODE_NAME -> Configure 配置Git工具> 页。在 Node Properties
部分,您必须启用 Tool Locations
,然后添加 Git 工具位置(您需要指定 Home
作为节点上安装的 Git) .
关于git - Jenkins 选择了错误的 git 二进制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54461330/