Reputation: 1666
git version - 2.6.4
I have stuck in a situation where I am not able to clone complete repo content using --recursive
flag.
My main repository have two sub-directory health-check
and hellspawn
.
I have created hellspawn
as submodule and it has its entry in .gitmodules
file also.
I am not sure what health-check
is, whether a submodule
or nested-git
.
health-check
does not have entry in .gitmodules
which make me thing it might be nested-git
.
if so , then why am I getting git message when cloning main repository with
[email protected]:~/try$git clone --recursive
[email protected]:url/mainrepo.git
Cloning into 'mainrepo'...
remote: Counting objects: 28713, done.
remote: Compressing objects: 100% (613/613), done.
remote: Total 28713 (delta 363), reused 5 (delta 5), pack-reused 28090
Receiving objects: 100% (28713/28713), 788.79 MiB | 3.54 MiB/s, done.
Resolving deltas: 100% (17645/17645), done.
Checking connectivity... done.
Checking out files: 100% (40522/40522), done.
No submodule mapping found in .gitmodules for path 'health-check'
`
As you can see last line if health-check
is nested git then why git is checking in .gitmodules
file ??
Due to this error, I am not getting code downloaded even in hellspawn
which is submodule.
Any help
Upvotes: 1
Views: 1187
Reputation: 1329712
health-check does not have entry in .gitmodules which make me thing it might be nested-git.
It is a nested git repo.
if
health-check
is nested git then why git is checking in.gitmodules
file
Because a nested git repo is recorded as a gitlink (as a submodule is), which means git checks if that special entry in the index matches one declared in the .gitmodules
file (because of the --recursive
option of git clone
, asking to clone submodules)
Since that special entry does not match any .gitmodules
entry path, it fails with that warning.
Due to this error, I am not getting code downloaded even in hellspawn which is submodule
Two approaches:
Get rid of that special entry:
Try and git rm --cached health-check
(no trailing '/
', as I mentioned in "git --recursive
doesn't clone submodule"), then add and push, and then try the git clone --recursive
again
Declare the submodule
That is:
git config -f .gitmodules submodule.health-check.path health-check
git config -f .gitmodules submodule.health-check.url https://github.com/<auser>/health-check
(replace <auser>
by the actual user managing that repo)
Again, add, push, then try the git clone --recursive
again.
Upvotes: 1