Py学习  »  Git

彻底解决 Jenkins Slaver 节点无法执行 Git-LFS 命令

鱿鱼先生 • 4 年前 • 354 次点击  
阅读 10

彻底解决 Jenkins Slaver 节点无法执行 Git-LFS 命令

最新配置新增一台iMac当作持续集成构建的Slaver节点,添加节点很顺利,但是拉取代码的时候发现无法正常。出现以下提示:

hudson.plugins.git.GitException: Command "git checkout -f 1465f8d3b3afa59d3f40b876debd6e08988d3d39" returned status code 128:
stdout: 
stderr: git-lfs filter-process: git-lfs: command not found
fatal: The remote end hung up unexpectedly

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$900(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2341)
复制代码

错误分析

错误中提示 git-lfs 找不到。

  1. ssh远程登陆主机查看大文件支持是否已经安装:

     $ which git-lsf
     /usr/local/bin/git-lfs
    复制代码
  2. 如果不能看到以上结果,先安装大文件支持。

     $ brew install git-lfs
     # 全局 git 的配置
     $ git lfs install
    复制代码

通过以上肯定已经有了,重试了一次还是无法正常拉取代码。说明命令行程序jenkins无法访问。我们需要修正下默认环境。

解决方法

执行命令:

$ git --exec-path
/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
复制代码

获得了git的默认访问路径,将 git-lfs命令拷贝到该路径下。

$ cp $(which git-lfs) /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
复制代码

如果提示无权限,在前头加上 sudo 就能成功。

Rebuild Jenkins集成任务搞定。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/37480
 
354 次点击