最新配置新增一臺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 找不到。
- ssh遠程登陸主機查看大文件支持是否已經(jīng)安裝:
$ which git-lsf
/usr/local/bin/git-lfs
- 如果不能看到以上結(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ù)搞定。