Jenkins - Git - 无法从 Git 存储库签出

问题描述 投票:0回答:2

我有一个 git 存储库,用于在 Jenkins 中进行构建。构建始终失败并出现以下错误:

Seen 1 remote branch
Commencing build of Revision 30c6a7a5e6fd30e8519fb3d604a1c195d48ea4fc (origin/master)
Checking out Revision 30c6a7a5e6fd30e8519fb3d604a1c195d48ea4fc (origin/master)
 > C:\Program Files (x86)\Git\cmd\git.exe config core.sparsecheckout
 > C:\Program Files (x86)\Git\cmd\git.exe checkout -f 30c6a7a5e6fd30e8519fb3d604a1c195d48ea4fc
FATAL: Could not checkout null with start point 30c6a7a5e6fd30e8519fb3d604a1c195d48ea4fc
hudson.plugins.git.GitException: Could not checkout null with start point 30c6a7a5e6fd30e8519fb3d604a1c195d48ea4fc
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$8.execute(CliGitAPIImpl.java:1497)
    at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.checkout(AbstractGitAPIImpl.java:64)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkout(CliGitAPIImpl.java:87)
    at hudson.plugins.git.GitAPI.checkout(GitAPI.java:208)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1273)
    at hudson.plugins.git.GitSCM.access$1100(GitSCM.java:57)
    at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1232)
    at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1208)
    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2439)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:63)
    at java.lang.Thread.run(Unknown Source)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\cmd\git.exe checkout -f 30c6a7a5e6fd30e8519fb3d604a1c195d48ea4fc" returned status code 1:
stdout: 
stderr: error: unable to create file 

有一个分支主控,sha-1 是最新结帐的。还出现以下内容:

Note: checking out '30c6a7a5e6fd30e8519fb3d604a1c195d48ea4fc'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 30c6a7a... Update README.md

我不确定为什么詹金斯认为回购处于无头状态?

git github jenkins jenkins-plugins
2个回答
3
投票

我也遇到了同样的问题,问题是文件路径太长,所以我将工作区更改为较短的字符串,然后它又工作了。


0
投票

我也遇到了同样的问题,就像:

FATAL: Could not checkout {commit id}
hudson.plugins.git.GitException: Command "git checkout -f {commit id}" returned status code -1:

运行以下命令后,问题解决了:

git lfs install

此外,以下页面可能对您有帮助:
https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage
https://docs.github.com/en/repositories/working-with-files/managing-large-files/configuring-git-large-file-storage

© www.soinside.com 2019 - 2024. All rights reserved.