# 2021-01-06 #「Git」- git rev-parse returned status code 128

问题描述

在 Jenkins 中,当构建开始后发生如下错误:

 > git rev-parse remotes/origin/test^{commit} # timeout=10
hudson.plugins.git.GitException: Command "git rev-parse remotes/origin/test^{commit}" returned status code 128:
stdout: remotes/origin/test^{commit}

stderr: fatal: ambiguous argument 'remotes/origin/test^{commit}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2010)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2006)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1638)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1650)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:835)
	at hudson.plugins.git.GitAPI.revParse(GitAPI.java:316)
	at hudson.plugins.git.RevisionParameterAction.toRevision(RevisionParameterAction.java:98)
	at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1076)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1193)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

问题原因

该问题成因与 Could not resolve refs tags 类似,都是由于”在命令行中所指定的 TAG 不存在“而导致的。

而不存在该 TAG 的原因是构建过程的错误操作,导致 Workspace 发生损坏。

解决办法

自己的锅,能怎么办………………


posted @ 2021-01-06 09:49  研究林纳斯写的  阅读(407)  评论(1编辑  收藏  举报