【发布时间】:2019-08-21 17:32:46
【问题描述】:
Gitlab 提供了这种方法可以将新项目直接推送到 gitlab,而无需先在 web-gui 上对其进行初始化。以下命令效果很好:
git push --set-upstream git@my.gitlab.com:username/project-name.git master
我想做同样的事情,但要遍历新项目中的所有子模块。我正在尝试使用子模块 foreach 获取以下命令:
git submodule foreach --recursive 'sudo git push --set-upstream https://my.gitlab.com/namespace/$project-name.git master'
但它会像这样失败:
Entering 'sub-repo-1'
> GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Stopping at 'sub-repo-1'; script returned non-zero status.
在我的用例中,我有一个项目树,其中包含我想推送到 gitlab 的数百个子模块。最终,我想将其集成到 CI 工作流程中,但首先要做的是。
任何想法为什么子模块 foreach push-to-create 在 gitlab CI 上不起作用?
【问题讨论】:
标签: git gitlab gitlab-ci git-submodules