使用jenkins进行git签出时出现异常:";没有这样的文件或目录;

使用jenkins进行git签出时出现异常:";没有这样的文件或目录;,git,jenkins,Git,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.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.549
Git插件版本2.0.1

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

“-Dorg.jenkinsci.plugins.gitclient.Git.useCLI=false”(与从属服务器相同)

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


有了这个,一切都很顺利。但别忘了JGit不是功能齐全的本地git

最后,本机git for windows有一个长路径选项:

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

git config--global core.longpaths true

指 有关该选项的更多详细信息。你应该只启用它 选项,因为msysgit人员会发出警告 当使用长路径时,可能存在与其他工具的兼容性问题 在核心git中启用


假设您的Jenkins正在Windows服务器上运行?