我正试图通过Jenkins从git获取最新代码。每次我这样做,我得到以下错误。我已经跟进了stackoverflow敌人的一些链接,但他们似乎都没有解决这个问题。
这是错误。
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
答案 0 :(得分:3)
我相信你这里有两个问题。
第一个:
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
实际上相对无害。我们遇到了同样的问题。这是因为读取树调用是在结账之前完成的。结账后设置ref HEAD。在我们的案例中这个错误没有引起任何进一步的问题。我们设法通过在结账前不执行完全擦除来摆脱这一个,但只是干净。
真正的问题是第二个错误:
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
我们也遇到了这个问题。在我们的例子中,这是由稀疏结账中的错误路径引起的。仔细检查您输入的路径是否正确。
答案 1 :(得分:0)
如果看到一个Not a valid object name HEAD
错误,但是git symbolic-ref HEAD
的输出似乎很好(例如refs/heads/master
),则可能的原因是所使用的Git版本之间不匹配,例如本地计算机上的Git位于2.x,但是远程计算机仍处于1.x。随时随地更新您的Git安装,以摆脱该特定问题。