ZDu*_*ker 6 git github git-submodules
我使用命令将https://github.com/boostorg/boost.git镜像到我自己的存储库:
git clone --recursive https://github.com/boostorg/boost.git
cd boost
git push --mirror 'URLOfMyOwnRepo'
Run Code Online (Sandbox Code Playgroud)
为了镜像所有子模块。然而,事情并没有按照我的预期进行。
基本上我想做的是 N 对 1 镜像,这样我就可以在不同的分支/标签中查看我自己的存储库上的源代码。
我试过:
git clone --mirror --recursive
和
git submodule init
git submodule sync
git submodule update --init --recursive
即使我在本地计算机上获得了这些子模块,我仍然无法将它们镜像到我的存储库。
小智 0
我刚刚经历了同样的经历,并在从 github 递归克隆 boost 后陷入困境。
最后,我创建了以下 bash 脚本来跳转到每个子模块文件夹,并手动将镜像推送到我的私人 gitlab 存储库。然后,当我尝试从我的私人 gitlab 进行 git 克隆时,主存储库似乎在新 url 上找到了每个子模块,而没有任何其他配置。
#!/bin/bash
# This file is meant to help a user mirror the submodule-rich github repo 'boost' on our private gitlab
# start in boost root directory of boost cloned with:
# git clone --recursive https://github.com/boostorg/boost.git
myhost=example.com
git submodule status | awk '{print $2}' > boost_git_submodules_list.txt
while read line; do
cd $line
module=`cut -d'/' -f2 <<< $line`
echo "git push --mirror git@$myhost:boostorg/$module.git"
git push --mirror git@$myhost:boostorg/$module.git
cd -
done < boost_git_submodules_list.txt
Run Code Online (Sandbox Code Playgroud)
这需要一段时间,并且在他们推送时有一些损坏的参考,但我希望这会有所帮助!
归档时间: |
|
查看次数: |
3034 次 |
最近记录: |