使用 jenkins 的 git 结帐期间异常:"No such file or directory"



我正在尝试从 jenkins 轮询 git 存储库。但它抛出了异常。.

FATAL: Could not checkout null with start point 1abd809011d37508b783f4f74245178ed632295a
hudson.plugins.git.GitException: Could not checkout null with start point 1abd809011d37508b783f4f74245178ed632295a
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkoutBranch(CliGitAPIImpl.java:1274)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:881)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:651)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:560)
at hudson.model.Run.execute(Run.java:1670)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: hudson.plugins.git.GitException: Command "git checkout -f 1abd809011d37508b783f4f74245178ed632295a" returned status code 128:
stdout: 
stderr: error: unable to create file sparkIncentiveCommon/src/main/java/com/ebay/spark/incentiveService/supportedpayment/SparkSupportedPaymentIncentiveRequest.java (No such file or directory)
fatal: cannot create directory at 'sparkIncentiveService/src/main/webapp/META-INF/configuration/QA/config/com/ebay/domain/core/common/featurecontingency': No such file or directory
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1148)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1125)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1121)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:937)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:947)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkout(CliGitAPIImpl.java:1248)
at hudson.plugins.git.GitAPI.checkout(GitAPI.java:208)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkoutBranch(CliGitAPIImpl.java:1258)
... 9 more

詹金斯版本 - 1.549Git 插件版本 - 2.0.1

最后,Windows 的原生 git 有一个长路径选项:

msysgit 开发团队已经实现了看似 msysgit 1.9.0 中的解决方案。看来解决方案需要 特别启用,但它可能允许您通过以下方式解决此问题 安装 msystgit 1.9.0 并运行

git config --global core.longpath true

指 https://github.com/msysgit/git/commit/c5f98452e98dca292c615000df7973ead63cf29b 有关该选项的更多详细信息。您可能只应该启用它 选项,如果您遇到问题,因为 msysgit 人员警告 长路径时可能存在与其他工具的兼容性问题 在核心 Git 中启用。

我们遇到了同样的问题。经过一些研究,似乎 Jenkins git 插件无法在 Windows 环境中处理太长的路径(> 259 个字符)。更准确地说 - git 插件在最新版本中通过命令行使用 git,这无法应对太长的路径。以前它使用没有此问题的 JGit 实现。您仍然可以使用 Jenkins 命令行参数切换回此实现:

"-Dorg.jenkinsci.plugins.gitclient.Git.useCLI=false" (slaves相同)

或者只是在 Jenkins 配置对话框中选择 JGit 作为实现。

有了这个,一切都运行良好。但不要忘记,JGit 不是功能齐全的原生 git!

相关内容

最新更新