如何解决stderr:致命的:不是有效的对象名称詹金斯头? [英] How to resolve stderr: fatal: Not a valid object name HEAD in jenkins?

查看:595
本文介绍了如何解决stderr:致命的:不是有效的对象名称詹金斯头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过Jenkins从git获得最新的代码。每次我这样做,我会得到以下错误。我已经通过一些关于这个stackoverflow对象的链接,但他们都没有解决这个问题。


  1. 尝试删除整个工作区,然后再次运行。它引发同样的错误。
  2. 包含git reset - 在Execute shell构建选项中



<

 检出版本bc304892eadfaaf7338fa6e5f370137555d7cfd9(refs / remotes / origin / master)
> C:\ Program Files \Git\bin\git.exe config core.sparsecheckout#timeout = 10
> C:\ Program Files \Git\bin\git.exe config core.sparsecheckout true#timeout = 10
> C:\ Program Files \Git\bin\git.exe read-tree -mu HEAD#timeout = 10
命令C:\ Program Files \Git\bin\git.exe read-tree -mu HEAD返回状态码128:
stdout:
stderr:fatal:不是有效的对象名称HEAD

> C:\程序文件\Git\bin\git.exe签出-f bc304892eadfaaf7338fa6e5f370137555d7cfd9
致命错误:无法签出bc304892eadfaaf7338fa6e5f370137555d7cfd9
hudson.plugins.git.GitException:无法签出bc304892eadfaaf7338fa6e5f370137555d7cfd9
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl $ 8.execute(CliGitAPIImpl.java:1907)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl $ CommandInvocationHandler $ 1.call(RemoteGitImpl.java:152)
在org.jenkinsci.plugins.gitclient.RemoteGitImpl $ CommandInvocationHandler $ 1.call(RemoteGitImpl.java:145)
at hudson.remoting.UserRequest.perform(UserRequest.java:120)
at hudson.remoting .UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request $ 2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService $ 1.call(InterceptingExecutorService.java:68 )在java.util.concurrent.FutureTask.run处的
(未知源)在java.util.concurrent.ThreadP处
oolExecutor.runWorker(未知源)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知源)
在hudson.remoting.Engine $ 1 $ 1.run(Engine.java:62)
at java.lang.Thread.run(Unknown Source)
......远程调用odesk.delta.04(本地方法)
at hudson.remoting.Channel.attachCallSiteStackTrace( Channel.java:1416)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
at hudson.remoting.Channel.call(Channel.java:781)
at org .jenkinsci.plugins.gitclient.RemoteGitImpl $ CommandInvocationHandler.execute(RemoteGitImpl.java:145)
at sun.reflect.GeneratedMethodAccessor434.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl。 java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl $ CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
在com.sun.proxy。$ Proxy51.exec ute(Unknown Source)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1060)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
at hudson.model.AbstractBuild $ AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy。
at hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1738)
at hudson .model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410 )
导致:hudson.plugins.git.GitException:命令C:\ Program Files \Git\bin\git.exe checkout -f bc304892eadfaaf7338fa6e5f370137555d7cfd9返回状态码128:
stdout :
stderr:错误:稀疏结帐离开没有条目在工作目录

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access $ 500(CliGitAPIImpl。 java:62)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl $ 8.execute(CliGitAPIImpl.java:1899)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl $ CommandInvocationHandler $ 1.call(RemoteGitImpl。 java:152)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl $ CommandInvocationHandler $ 1.call(RemoteGitImpl.java:145)
at hudson.remoting.UserRequest.perform(UserRequest.java:120)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request $ 2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService $ 1。调用(InterceptingExecutorService.java:68)
在java.util.concurrent.FutureTask.run(未知源)
在java.util.concurrent.ThreadPoolExecutor.runWorker(未知源)
在java .uti l.concurrent.ThreadPoolExecutor $ Worker.run(未知源)$ b $ h at hudson.remoting.Engine $ 1 $ 1.run(Engine.java:62)
at java.lang.Thread.run(Unknown Source)
完成:FAILURE


解决方案

我相信你有这里有两个问题。



第一个:

 命令C:\Program Files \Git\bin\git.exe read-tree -mu HEAD返回
状态码128:
stdout:
stderr:致命:不是有效的对象名称HEAD

实际上是相对无害的。我们遇到了同一个。这是由于读取树调用在结帐之前完成的。结帐后ref HEAD被设置。这个错误在我们的案例中没有引起任何进一步的问题。我们设法通过在结帐之前不进行全面擦拭来摆脱这个问题,但只是一个干净的。

真正的问题是第二个错误:

  hudson.plugins.git.GitException:命令C:\ Program Files \Git\bin\git.exe checkout -f bc304892eadfaaf7338fa6e5f370137555d7cfd9返回状态码128:
stdout:
stderr:错误:稀疏结账在工作目录中没有输入

我们也遇到了这个问题。在我们的例子中,这是由稀疏结帐中的不正确路径引起的。仔细检查您输入的路径是否正确。

I am trying to get the latest code from git through Jenkins. Everytime I do so I get the following error. I have followed in through a few links on stackoverflow foe this but none of them seem to resolve the issue.

  1. Tried deleting the entire workspace and then run again. It throws the same error.
  2. Included git reset --hard in the Execute shell build option

Here is the error.

Checking out Revision bc304892eadfaaf7338fa6e5f370137555d7cfd9 (refs/remotes/origin/master)
 > C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10
 > C:\Program Files\Git\bin\git.exe config core.sparsecheckout true # timeout=10
 > C:\Program Files\Git\bin\git.exe read-tree -mu HEAD # timeout=10
Command "C:\Program Files\Git\bin\git.exe read-tree -mu HEAD" returned status code 128:
stdout: 
stderr: fatal: Not a valid object name HEAD

 > C:\Program Files\Git\bin\git.exe checkout -f bc304892eadfaaf7338fa6e5f370137555d7cfd9
FATAL: Could not checkout bc304892eadfaaf7338fa6e5f370137555d7cfd9
hudson.plugins.git.GitException: Could not checkout bc304892eadfaaf7338fa6e5f370137555d7cfd9
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$8.execute(CliGitAPIImpl.java:1907)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:62)
    at java.lang.Thread.run(Unknown Source)
    at ......remote call to odesk.delta.04(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
    at hudson.remoting.Channel.call(Channel.java:781)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
    at sun.reflect.GeneratedMethodAccessor434.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
    at com.sun.proxy.$Proxy51.execute(Unknown Source)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1060)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe checkout -f bc304892eadfaaf7338fa6e5f370137555d7cfd9" returned status code 128:
stdout: 
stderr: error: Sparse checkout leaves no entry on working directory

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:62)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$8.execute(CliGitAPIImpl.java:1899)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:62)
    at java.lang.Thread.run(Unknown Source)
Finished: FAILURE

解决方案

I believe you have two issues here.

The first one:

Command "C:\Program Files\Git\bin\git.exe read-tree -mu HEAD" returned 
status code 128:
stdout: 
stderr: fatal: Not a valid object name HEAD

is actually relatively harmless. We encountered the same one. This is caused by the fact that the read-tree call is done before the checkout. The ref HEAD gets set after the checkout. This error in our case did not cause any further problems. We managed to get rid of this one by not performing a full wipe before a checkout, but only a clean.

The real problem is the second error:

Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe checkout -f bc304892eadfaaf7338fa6e5f370137555d7cfd9"     returned status code 128:
stdout: 
stderr: error: Sparse checkout leaves no entry on working directory

We also encountered this problem. In our case this was caused by incorrect paths in the sparse checkout. Double check if the paths you entered there are correct.

这篇关于如何解决stderr:致命的:不是有效的对象名称詹金斯头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆