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

标签 git jenkins server jenkins-plugins

我有一个运行在 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:

enter image description here

  • Server (Linux) Global Tool Configuration 下提到的 Git:

enter image description here

最佳答案

需要在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/

相关文章:

java - 在服务器上运行 spring boot

javascript - Webpack + React : pass commit SHA from webpack to JS

ssl - 带有 HTTPS 的 Jenkins CLI

jenkins - 在 Jenkins 的参数化作业中可以作为变量传递的最大字符串长度是多少?

go - 创建服务器并连接到它

tomcat - Netbeans Tomcat 服务器问题

git - 是否可以从一个目录创建 git 补丁并将该补丁应用到不同的目录?

与 master 不同的分支的 github 贡献

git - 无法将 git repo 推送到 Digital Ocean 液滴上的 Dokku 远程?

Jenkins 声明式管道动态选择参数在首次构建后不会更新