Jenkins Error : Could not checkout <branch name> with start point <SHA1>
Jenkins Error : Could not checkout <branch name> with start point <SHA1>
我从 develop
分支创建了一个分支,并为这个新分支配置了一个 Jenkins 作业。实际上,在分支出这个新分支之前,我必须删除 develop
分支中的现有目录(在本地删除目录,然后提交更改并推送到远程),所以这是 .
强制构建 Jenkins 后出现错误 "Could not checkout <branch name> with start point <SHA1>"
。这个 SHA1 是我在通过删除目录分支出这个新分支之前在 develop 分支上完成的最后一次提交。
我尝试了几种方法,如重建、清除工作-space然后重建等,但都没有成功。尽管 Jenkins 无法检出,但我的本地 git 存储库可以检出到这个新分支并在其上工作而不会出现任何问题。
我正在努力解决这个问题,但没有取得多大成功,发现了这个 Jenkins 问题,但我不确定是否相同。 https://issues.jenkins-ci.org/browse/JENKINS-26748
有人可以帮我解决这个问题吗?
以下是完整日志...
Started by user anonymous
Building in workspace C:\Projects\CI_01\Jenkins_1.6\jobs\Velo-TFS675-InvoiceRegister\workspace
Cloning the remote Git repository
Cloning repository https://git.mesite.com/EAG/Velo.git
> C:\Projects\Git\bin\git.exe init C:\Projects\CI_01\Jenkins_1.6\jobs\Velo-TFS675-InvoiceRegister\workspace # timeout=10
Fetching upstream changes from https://git.mesite.com/EAG/Velo.git
> C:\Projects\Git\bin\git.exe --version # timeout=10
using .gitcredentials to set credentials
> C:\Projects\Git\bin\git.exe config --local credential.username ourbuildusr # timeout=10
> C:\Projects\Git\bin\git.exe config --local credential.helper store --file=\"C:\Users\BUILD~1\AppData\Local\Temp\git8122784540015506.credentials\" # timeout=10
> C:\Projects\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://git.mesite.com/EAG/Velo.git +refs/heads/*:refs/remotes/origin/* # timeout=60
> C:\Projects\Git\bin\git.exe config --local --remove-section credential # timeout=10
> C:\Projects\Git\bin\git.exe config remote.origin.url https://git.mesite.com/EAG/Velo.git # timeout=10
> C:\Projects\Git\bin\git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> C:\Projects\Git\bin\git.exe config remote.origin.url https://git.mesite.com/EAG/Velo.git # timeout=10
Fetching upstream changes from https://git.mesite.com/EAG/Velo.git
using .gitcredentials to set credentials
> C:\Projects\Git\bin\git.exe config --local credential.username ourbuildusr # timeout=10
> C:\Projects\Git\bin\git.exe config --local credential.helper store --file=\"C:\Users\EAGBUI~1\AppData\Local\Temp\git8122784540015506.credentials\" # timeout=10
> C:\Projects\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://git.mesite.com/EAG/Velo.git +refs/heads/*:refs/remotes/origin/* # timeout=60
> C:\Projects\Git\bin\git.exe config --local --remove-section credential # timeout=10
> C:\Projects\Git\bin\git.exe rev-parse "refs/remotes/origin/tfs675-invoice_register^{commit}" # timeout=10
> C:\Projects\Git\bin\git.exe rev-parse "refs/remotes/origin/origin/tfs675-invoice_register^{commit}" # timeout=10
Checking out Revision 7dc4f9190358c20b01d2980e3ba5c7039ace377c (refs/remotes/origin/tfs675-invoice_register)
> C:\Projects\Git\bin\git.exe config core.sparsecheckout # timeout=10
> C:\Projects\Git\bin\git.exe checkout -f 7dc4f9190358c20b01d2980e3ba5c7039ace377c # timeout=10
ERROR: Timeout after 10 minutes
FATAL: Could not checkout tfs675-invoice_register with start point 7dc4f9190358c20b01d2980e3ba5c7039ace377c
hudson.plugins.git.GitException: Could not checkout tfs675-invoice_register with start point 7dc4f9190358c20b01d2980e3ba5c7039ace377c
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:1905)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1060)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1282)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: hudson.plugins.git.GitException: Command "C:\Projects\Git\bin\git.exe checkout -f 7dc4f9190358c20b01d2980e3ba5c7039ace377c" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1616)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1612)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1254)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1266)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:1881)
... 10 more
我还没有完全按照所示看到此错误。当尝试检出的分支已从远程删除时,我经常会看到类似的错误。但是要做的一件事是,在你的詹金斯工作的 git 克隆选项中,设置 clean before checkout
我们也 prune stale remote branches
需要删除工作区中的旧项目,运行在 Jenkins 中再次测试以克隆
为确保您的工作区不被破坏,最好删除工作区并尝试重新构建。或者使用 clean before checkout
我确实通过启用 Git LFS after checkout
解决了我的问题,因为我的存储库使用的是 Git LFS。
我从 develop
分支创建了一个分支,并为这个新分支配置了一个 Jenkins 作业。实际上,在分支出这个新分支之前,我必须删除 develop
分支中的现有目录(在本地删除目录,然后提交更改并推送到远程),所以这是 .
强制构建 Jenkins 后出现错误 "Could not checkout <branch name> with start point <SHA1>"
。这个 SHA1 是我在通过删除目录分支出这个新分支之前在 develop 分支上完成的最后一次提交。
我尝试了几种方法,如重建、清除工作-space然后重建等,但都没有成功。尽管 Jenkins 无法检出,但我的本地 git 存储库可以检出到这个新分支并在其上工作而不会出现任何问题。
我正在努力解决这个问题,但没有取得多大成功,发现了这个 Jenkins 问题,但我不确定是否相同。 https://issues.jenkins-ci.org/browse/JENKINS-26748
有人可以帮我解决这个问题吗?
以下是完整日志...
Started by user anonymous
Building in workspace C:\Projects\CI_01\Jenkins_1.6\jobs\Velo-TFS675-InvoiceRegister\workspace
Cloning the remote Git repository
Cloning repository https://git.mesite.com/EAG/Velo.git
> C:\Projects\Git\bin\git.exe init C:\Projects\CI_01\Jenkins_1.6\jobs\Velo-TFS675-InvoiceRegister\workspace # timeout=10
Fetching upstream changes from https://git.mesite.com/EAG/Velo.git
> C:\Projects\Git\bin\git.exe --version # timeout=10
using .gitcredentials to set credentials
> C:\Projects\Git\bin\git.exe config --local credential.username ourbuildusr # timeout=10
> C:\Projects\Git\bin\git.exe config --local credential.helper store --file=\"C:\Users\BUILD~1\AppData\Local\Temp\git8122784540015506.credentials\" # timeout=10
> C:\Projects\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://git.mesite.com/EAG/Velo.git +refs/heads/*:refs/remotes/origin/* # timeout=60
> C:\Projects\Git\bin\git.exe config --local --remove-section credential # timeout=10
> C:\Projects\Git\bin\git.exe config remote.origin.url https://git.mesite.com/EAG/Velo.git # timeout=10
> C:\Projects\Git\bin\git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> C:\Projects\Git\bin\git.exe config remote.origin.url https://git.mesite.com/EAG/Velo.git # timeout=10
Fetching upstream changes from https://git.mesite.com/EAG/Velo.git
using .gitcredentials to set credentials
> C:\Projects\Git\bin\git.exe config --local credential.username ourbuildusr # timeout=10
> C:\Projects\Git\bin\git.exe config --local credential.helper store --file=\"C:\Users\EAGBUI~1\AppData\Local\Temp\git8122784540015506.credentials\" # timeout=10
> C:\Projects\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://git.mesite.com/EAG/Velo.git +refs/heads/*:refs/remotes/origin/* # timeout=60
> C:\Projects\Git\bin\git.exe config --local --remove-section credential # timeout=10
> C:\Projects\Git\bin\git.exe rev-parse "refs/remotes/origin/tfs675-invoice_register^{commit}" # timeout=10
> C:\Projects\Git\bin\git.exe rev-parse "refs/remotes/origin/origin/tfs675-invoice_register^{commit}" # timeout=10
Checking out Revision 7dc4f9190358c20b01d2980e3ba5c7039ace377c (refs/remotes/origin/tfs675-invoice_register)
> C:\Projects\Git\bin\git.exe config core.sparsecheckout # timeout=10
> C:\Projects\Git\bin\git.exe checkout -f 7dc4f9190358c20b01d2980e3ba5c7039ace377c # timeout=10
ERROR: Timeout after 10 minutes
FATAL: Could not checkout tfs675-invoice_register with start point 7dc4f9190358c20b01d2980e3ba5c7039ace377c
hudson.plugins.git.GitException: Could not checkout tfs675-invoice_register with start point 7dc4f9190358c20b01d2980e3ba5c7039ace377c
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:1905)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1060)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1282)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: hudson.plugins.git.GitException: Command "C:\Projects\Git\bin\git.exe checkout -f 7dc4f9190358c20b01d2980e3ba5c7039ace377c" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1616)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1612)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1254)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1266)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:1881)
... 10 more
我还没有完全按照所示看到此错误。当尝试检出的分支已从远程删除时,我经常会看到类似的错误。但是要做的一件事是,在你的詹金斯工作的 git 克隆选项中,设置 clean before checkout
我们也 prune stale remote branches
需要删除工作区中的旧项目,运行在 Jenkins 中再次测试以克隆
为确保您的工作区不被破坏,最好删除工作区并尝试重新构建。或者使用 clean before checkout
我确实通过启用 Git LFS after checkout
解决了我的问题,因为我的存储库使用的是 Git LFS。