使用子模块镜像Eclipse Platform Aggregator存储库 [英] Mirroring Eclipse Platform Aggregator Repository with Sub Modules
问题描述
我正在尝试镜像Eclipse平台聚合器模块( https ://git.eclipse.org/r/platform/eclipse.platform.releng.aggregator.git )添加到gitlab存储库.
I am trying to mirror eclipse platform aggregator module (https://git.eclipse.org/r/platform/eclipse.platform.releng.aggregator.git) to a gitlab repository.
目的是将竞争源(包括子模块)托管在本地存储库中,并构建eclipse平台,而无需从外部网络访问源代码.
The purpose is to have the compete source (including submodules) hosted in a local repo, and build eclipse platform without accessing source code from external network.
这是遵循的步骤
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
第一次尝试,内容被推送到本地仓库. 但是,从本地存储库克隆存储库时,返回以下错误
In first attempt , the contents got pushed to local repo. But while cloning the repository from local repo returned the following error
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的任何帮助将不胜感激
But cloning from local repo , failed with same error (as in Attempt 1). Any help to mirror this Repo along with submodules, to Gitab Repo , would be greatly appreciated
感谢和问候 Bipin.
Thanks and Regards Bipin.
推荐答案
默认情况下,克隆子模块时,将使用.gitmodules
文件中使用的URL.由于该文件仍然与您要镜像的存储库中的文件相同,因此Git会尝试从原始远程获取数据.
By default, when you clone a submodule, the URL used in the .gitmodules
file is used. Since that file is still the same as in the repository you're mirroring, Git will attempt to fetch that data from the original remote.
您需要在本地网络上分别镜像每个存储库.存储在存储库中的数据不包含来自其子模块的任何数据,仅包含.gitmodules
目录中的引用.
You'll need to mirror each repository individually on your local network. The data stored in a repository doesn't contain any data from its submodules, only the references in the .gitmodules
directory.
对于解决克隆问题,最简单的方法是使用URL重写.因此,如果要使用https://mirror.example.org/foo/
作为根目录而不是https://git.eclipse.org/r/platform/
,则可以运行以下命令:
As for solving the cloning problem, the easiest way to do that is to use a URL rewrite. So if you wanted to use https://mirror.example.org/foo/
as your root instead of https://git.eclipse.org/r/platform/
, you'd run the following command:
git config --global "url.https://mirror.example.org/foo/.insteadOf" https://git.eclipse.org/r/platform/
请注意,您无法使此配置设置在存储库本地,因为克隆子模块时,大多数父存储库的设置都会被忽略.
Note that you cannot make this configuration setting local to the repository, because when you clone a submodule, the settings of the parent repository are mostly ignored.
这篇关于使用子模块镜像Eclipse Platform Aggregator存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!