徹底解決 Jenkins Slaver 節(jié)點無法執(zhí)行 Git-LFS 命令

最新配置新增一臺iMac當(dāng)作持續(xù)集成構(gòu)建的Slaver節(jié)點,添加節(jié)點很順利,但是拉取代碼的時候發(fā)現(xiàn)無法正常。出現(xiàn)以下提示:

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遠程登陸主機查看大文件支持是否已經(jīng)安裝:
$ which git-lsf
/usr/local/bin/git-lfs
  1. 如果不能看到以上結(jié)果,先安裝大文件支持。
$ brew install git-lfs
# 全局 git 的配置
$ git lfs install

通過以上肯定已經(jīng)有了,重試了一次還是無法正常拉取代碼。說明命令行程序jenkins無法訪問。我們需要修正下默認(rèn)環(huán)境。

解決方法

執(zhí)行命令:

$ git --exec-path
/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core

獲得了git的默認(rèn)訪問路徑,將 git-lfs命令拷貝到該路徑下。

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

如果提示無權(quán)限,在前頭加上 sudo 就能成功。

Rebuild Jenkins集成任務(wù)搞定。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容