完全解決 Jenkins Slaver 節點沒法執行 Git-LFS 命令

最新配置新增一臺iMac看成持續集成構建的Slaver節點,添加節點很順利,可是拉取代碼的時候發現沒法正常。出現如下提示:java

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 找不到。git

  1. ssh遠程登錄主機查看大文件支持是否已經安裝:app

    $ which git-lsf
     /usr/local/bin/git-lfs
    複製代碼
  2. 若是不能看到以上結果,先安裝大文件支持。ssh

    $ brew install git-lfs
     # 全局 git 的配置
     $ git lfs install
    複製代碼

經過以上確定已經有了,重試了一次仍是沒法正常拉取代碼。說明命令行程序jenkins沒法訪問。咱們須要修正下默認環境。ui

解決方法

執行命令:spa

$ 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 就能成功。3d

Rebuild Jenkins集成任務搞定。code

相關文章
相關標籤/搜索