gitlab自动构建报错–fatal: git fetch-pack: expected shallow list

gitlab-runner 多分支构建,同时跑流水线,会出现以下报错:

 Running with gitlab-runner 15.10.1 (dcfb4b66)
   on core 9c0e9c6a, system ID: s_0e9ee45aff8f
Preparing the "shell" executor
00:00
 Using Shell (bash) executor...
Preparing environment
00:00
 Running on gitlab-runner2...
Getting source from Git repository
00:00
 Fetching changes with git depth set to 50...
 重新初始化现存的 Git 版本库于 /home/gitlab-runner/builds/9c0e9c6a/0/project/cloud-native/business/sales/sales-digital-secretary/.git/
 fatal: git fetch-pack: expected shallow list
Getting source from Git repository
00:00
 Fetching changes with git depth set to 50...
 重新初始化现存的 Git 版本库于 /home/gitlab-runner/builds/9c0e9c6a/0/project/cloud-native/business/sales/sales-digital-secretary/.git/
 fatal: git fetch-pack: expected shallow list
 ERROR: Job failed: exit status 1

解决方法:
在 .gitlab-ci.yml 添加变量:

variables:
  GIT_STRATEGY: clone