報錯信息:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1735) ... ...
本來Jenkins都是正常的,但是突然構建一個job的時候出現了此報錯,然后Jenkins上所有的job構建都不成功,同樣報這種錯誤。在網上查找一些資料,最終確認是git的http.postBuffer配置默認值大小的問題,此配置是用來限制git推送大小的,由於代碼里有大文件導致拉取代碼時postBuffer溢出,所以需要增大http.postBuffer的值。
解決方法:在服務器上使用命令修改,執行命令時使用Jenkins用戶執行
su - jenkins -c "git config --global http.postBuffer 524288000"
但是,執行后必須要重啟Jenkins,不然不會生效的。隨后就能在Jenkins的家目錄下面看到配置文件 .gitconfig