Gitlab CI 运行程序中 git 子模块的错误 - "fatal: destination path already exists and is not an empty directory."



我正在尝试将一个子模块包含到我的GitLab存储库中。它在本地运行得很好,但我的构建管道失败了。根据这个文档条目,我所要做的就是使用相对url并设置GIT_SUBMODULE_STRATEGY,但它并没有真正起作用。

我的.gitmodules:

[submodule "res/submoduleName"]
path = res/submoduleName
url = ../submoduleName.git

.gitlab-ci.yml:

variables:
GIT_SUBMODULE_STRATEGY: recursive
integration-test:
# ... 

我在我的管道外壳中得到以下错误:

Updating/initializing submodules recursively...
Submodule 'res/submoduleName' (https://gitlab-ci-token:[MASKED]@gitlab.com/mainProjectName/submoduleName.git) registered for path 'res/submoduleName'
fatal: destination path '/builds/_oBZKNaH/0/mainProjectName/mainProjectName/res/submoduleName' already exists and is not an empty directory.
fatal: clone of 'https://gitlab-ci-token:[MASKED]@gitlab.com/mainProjectName/submoduleName.git' into submodule path '/builds/_oBZKNaH/0/mainProjectName/mainProjectName/res/submoduleName' failed
Failed to clone 'res/submoduleName'. Retry scheduled
fatal: destination path '/builds/_oBZKNaH/0/mainProjectName/mainProjectName/res/submoduleName' already exists and is not an empty directory.
fatal: clone of 'https://gitlab-ci-token:[MASKED]@gitlab.com/mainProjectName/submoduleName.git' into submodule path '/builds/_oBZKNaH/0/mainProjectName/mainProjectName/res/submoduleName' failed
Failed to clone 'res/submoduleName' a second time, aborting
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1

我能做些什么来解决这个问题?

错误消息具有误导性。文件夹是空的,但GitLab runner没有写入权限。我通过在作业的before_script中添加- chmod -R 777 res来解决这个问题。

相关内容

最新更新