首页 > 解决方案 > 来自 Jenkins 的 Git 结帐错误,状态码为 128

问题描述

当我尝试使用 jenkins 从 Git 签出项目时,有时我会遇到此错误。我的 Jenkins 项目是管道项目。

Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe fetch --no-tags --progress https://hqreadonlyuser@bitbucket.highq.com/scm/col/collaborate.git +refs/heads/*:refs/remotes/origin/* --depth=1" returned status code 128:
stdout: 
stderr: fatal: Unable to create 'D:/jenkins_slave/workspace/Collaborate/Automation/File/File_7/oldAutomationTests/.git/shallow.lock': File exists.

标签: gitjenkins

解决方案


您可以在您的 repo 目录中使用以下命令:-

对于Linux:-

rm -r /home/myuser/my_source_code/.git/shallow.lock

对于 Windows:-

cd .git del shallow.lock

您还可以安装“pre-scm build”插件和 pre-scm 步骤以无条件地删除 .git 目录中的锁定文件,如果您经常看到这种情况足以证明更改作业定义的合理性。


推荐阅读