简体   繁体   English

使用jenkins进行git checkout期间发生异常:“无此文件或目录”

[英]Exception during git checkout using jenkins: “No such file or directory”

I am trying to poll git repo from jenkins. 我正在尝试从詹金斯投票git repo。 But it throws below exception.. 但是它抛出异常。

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

Jenkins version - 1.549 Git plugin ver - 2.0.1 Jenkins版本-1.549 Git插件版本-2.0.1

Finally, the native git for windows has an option for long paths: 最后,用于Windows的本机git具有长路径选项:

The msysgit development team has implemented what appears to be a solution in msysgit 1.9.0. msysgit开发团队已在msysgit 1.9.0中实现了似乎是解决方案的解决方案。 It appears that the solution needs to be specifically enabled, but it may allow you to resolve this problem by installing msystgit 1.9.0 and running 似乎需要专门启用该解决方案,但是它可能允许您通过安装msystgit 1.9.0并运行来解决此问题。

git config --global core.longpaths true git config --global core.longpaths是

Refer to https://github.com/msysgit/git/commit/c5f98452e98dca292c615000df7973ead63cf29b for more details on the option. 请参阅https://github.com/msysgit/git/commit/c5f98452e98dca292c615000df7973ead63cf29b了解有关该选项的更多详细信息。 You should probably only enable that option if you encounter the problem, since the msysgit people warn that there may be compatibility issues with other tools when longpaths are enabled in core git. 您可能仅应在遇到问题时启用该选项,因为msysgit人士警告说,在核心git中启用长路径时,其他工具可能存在兼容性问题。

We had the same issue. 我们有同样的问题。 After some research it seems that the Jenkins git plugin cannot cope with too long paths (> 259 chars) under Windows environments. 经过一些研究,似乎在Windows环境下,Jenkins git插件无法应对太长的路径(> 259个字符)。 To be more precise - the git plugin uses git via command line in the latest version and this cannot cope with too long paths. 更准确地说-git插件在最新版本中通过命令行使用git,因此无法解决路径太长的问题。 Formerly it used JGit implementation that doesn't have this issue. 以前它使用的JGit实现没有此问题。 You can still switch back to this implementation with the Jenkins command line argument: 您仍然可以使用Jenkins命令行参数切换回此实现:

"-Dorg.jenkinsci.plugins.gitclient.Git.useCLI=false" (same for slaves) “ -Dorg.jenkinsci.plugins.gitclient.Git.useCLI = false” (与奴隶相同)

or just choose JGit as implementation in the Jenkins configuration dialogue. 或者只是在Jenkins配置对话框中选择JGit作为实现。

With this everything runs fine. 一切顺利。 But don't forget that JGit is no fully featured native git! 但是请不要忘记JGit不是功能齐全的本地git!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM