使用子模块镜像Eclipse Platform Aggregator存储库

时间:2019-05-25 17:16:06

标签: git

我正在尝试将Eclipse平台聚合器模块(https://git.eclipse.org/r/platform/eclipse.platform.releng.aggregator.git)镜像到gitlab存储库。

目的是将竞争源(包括子模块)托管在本地存储库中,并构建eclipse平台,而无需从外部网络访问源代码。

这是遵循的步骤

尝试1

git clone --mirror https://git.eclipse.org/r/platform/eclipse.platform.releng.aggregator.git #with and without --recurse-submodules
git remote set-url --push origin ${local_repo_url}
git push --mirror # with and without --recurse-submodules=check

第一次尝试,内容被推送到本地仓库。 但是从本地存储库克隆存储库时,返回以下错误

 a) Cloned Metadata       -> Successful
 b) Registered SubModules -> Succesful
 c) Clone Sub Modules     -> Failed

Cloning into 'path/eclipse-platform/eclipse.jdt'...
remote: The project you were looking for could not be found.
fatal: repository 'local_repo_url/jdt/eclipse.jdt.git/' not found
fatal: clone of local_repo/jdt/eclipse.jdt' into submodule 
path 'path/eclipse-platform/eclipse.jdt' failed
Failed to clone 'eclipse.jdt'. Retry scheduled 

尝试2

git clone https://git.eclipse.org/r/platform/eclipse.platform.releng.aggregator.gi t --recurse-submodules #without mirror
git checkout master
git pull --recurse-submodules
git submodule update
git remote set-url --push origin ${local_repo_url}
git push --mirror --recurse-submodules=check

但是从本地存储库克隆失败,出现相同的错误(与尝试1中一样)。 将这个Repo及其子模块镜像到Gitab Repo的任何帮助将不胜感激

感谢和问候 Bipin。

1 个答案:

答案 0 :(得分:0)

默认情况下,克隆子模块时,将使用.gitmodules文件中使用的URL。由于该文件仍然与您正在镜像的存储库中的文件相同,因此Git将尝试从原始远程获取数据。

您需要在本地网络上分别镜像每个存储库。存储在存储库中的数据不包含来自其子模块的任何数据,仅包含.gitmodules目录中的引用。

对于解决克隆问题,最简单的方法是使用URL重写。因此,如果您想使用https://mirror.example.org/foo/作为根目录而不是https://git.eclipse.org/r/platform/,请运行以下命令:

git config --global "url.https://mirror.example.org/foo/.insteadOf" https://git.eclipse.org/r/platform/

请注意,您无法将此配置设置设置为本地存储库,因为克隆子模块时,大多数父存储库的设置都会被忽略。