I have multiple separate git repos which have no submodules in them. The task is to assemble a hierarchical tree of those repos and use it to share between users. This is trivial with 'subtree' or 'subrepo' schemes, but it seems not to work with 'submodules'. The reason to try submodules is slow git performance on the nfs systems. In my case checkout takes more than 2 hours
I am trying to create a shared repo which contains submodules. So far the very first attempt to clone fails. Here is the test case:
mkdir m1 ; cd m1 ; git init ; date > a.txt ; git add --all ; git commit -m added ; cd -
mkdir m2 ; cd m2 ; git init ; date > b.txt ; git add --all ; git commit -m added ; cd -
mkdir m3 ; cd m3 ; git init ; date > c.txt ; git add --all ; git commit -m added ; cd -
mkdir msub; cd msub; git init; date > d.txt; git add --all; git commit -m added;
git submodule add `realpath ../m1` m1
cd m1
git submodule add `realpath ../../m2` m2
git submodule add `realpath ../../m3` m3
git commit -m 'added submodules'
cd ..
git commit -m 'added a submodule'
cd ..
git clone --recursive msub msub1
As a result it creates msub1 with a single top-level submodule (m1).
In other cases I was getting a fatal error similar to this after the clone of the first submodule.
fatal: git upload-pack: not our ref 89434ad65c1e697bfa311cd0260dfe1997985e65
fatal: remote error: upload-pack: not our ref 89434ad65c1e697bfa311cd0260dfe1997985e65
Fetched in submodule path 'soc', but it did not contain 89434ad65c1e697bfa311cd0260dfe1997985e65. Direct fetching of that commit failed.
I tried adding submodules to 'm1' directly and it seemed to improve the situation, but I cannot do it with the real repos.
So, the desired scheme does not seem to work. Is there a way to fix it?
git clone
commands, perhaps individually selectable. – Leontina