Gitlab CI runner 中 git 子模块的错误 - "fatal: destination path already exists and is not an empty directory."
Error for git submodule in Gitlab CI runner - "fatal: destination path already exists and is not an empty directory."
我正在尝试将一个子模块包含到我的 GitLab 存储库中。它在本地工作得很好,但我的构建管道失败了。根据 this docs entry,我应该做的就是使用相对 url 并设置 GIT_SUBMODULE_STRATEGY
,但它并没有真正起作用。
我的.gitmodules
:
[submodule "res/submoduleName"]
path = res/submoduleName
url = ../submoduleName.git
.gitlab-ci.yml
:
variables:
GIT_SUBMODULE_STRATEGY: recursive
integration-test:
# ...
我的管道中出现以下错误 shell:
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 没有写入权限。我通过将 - chmod -R 777 res
添加到我工作的 before_script 来解决问题。
我正在尝试将一个子模块包含到我的 GitLab 存储库中。它在本地工作得很好,但我的构建管道失败了。根据 this docs entry,我应该做的就是使用相对 url 并设置 GIT_SUBMODULE_STRATEGY
,但它并没有真正起作用。
我的.gitmodules
:
[submodule "res/submoduleName"]
path = res/submoduleName
url = ../submoduleName.git
.gitlab-ci.yml
:
variables:
GIT_SUBMODULE_STRATEGY: recursive
integration-test:
# ...
我的管道中出现以下错误 shell:
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 没有写入权限。我通过将 - chmod -R 777 res
添加到我工作的 before_script 来解决问题。