git shallow 不适用于 jenkins 上的子模块?

git shallow is not working for submodules over jenkins?

我正在将 esp-idf 作为我开发的子模块,我也为此集成了 Jenkins。它 运行 完全没有在 Jenkins 上添加浅层克隆功能。 但是,当我尝试使用深度为 1、5 到 10 的浅克隆克隆子模块时,它会抛出与下面相同的错误,

Cloning into 'platform/esp32'... fatal: reference is not a tree: 286202caa31b61c2182209f37f8069a0b60fb942 Unable to checkout '286202caa31b61c2182209f37f8069a0b60fb942' in submodule path 'SDK/platform/esp32' Failed to recurse into submodule path 'SDK'

但是,它在 git 命令和没有 Jenkins 的情况下工作正常。

任何帮助对我都是有益的。

我的 Jenkins 设置如下所示,

Jenkins issue 60204 for git-scm plugin 中也有报道。
确保您拥有该插件的最新版本。

尝试清理与作业关联的 Jenkins 工作区(在 WS cleanup plugin 的帮助下)

JENKINS 63581 所述:

The job definition you uploaded as config.xml includes the "clean before checkout" behavior but does not include the "wipe workspace" behavior.

The "clean before checkout" behavior retains the existing git repository (the .git directory) but removes untracked files.
It does that with the git clean -xfd command.

If the workspace had been previously populated with repository content, the "clean before checkout" does not remove that previously created content.

The git plugin tries to reduce data transfer by retaining the git repository across multiple builds in the same workspace.
You would need to add "Wipe workspace" to assure that the two workspaces have the same content.

If wipe workspace still shows a difference, then it is likely that there is a difference due to the two versions of command line git being used.

OP Bhargav Lalaji adds in :

I was checking the git command line on the different system and Jenkins was setup on other system.
After check the git versions both of them have different version.

After upgrade the git version from 2.7.4 to 2.34.1, I am able to checkout submodule with shallow clone with Jenkins