Any experts on Git sub-modules here?

So, I have a Git repository that was created by a colleague and that contains a number of sub-modules. Usually, when I have worked with Git sub-modules before, then a simple clone --recursive would fetch the "main" repository and all the nested sub-modules. But, with this "problematic" repository, the sub-directories for the sub-modules are just empty after the clone (with "--recursive" flag)! There's no error message or anything. Just nothing. Of course, the subsequent build will fail with missing files 🙄

Now, we also have GitLab as a Web-GUI for our Git server. In my other repositories, when I have some sub-modules, GitLab is smart: I can just click on the sub-module "folder" and then GitLab automatically navigates to the corresponding repository. But, with the "problematic" repository, if I click on the sub-module "folder" in GitLab, simply nothing happens. Again, nor error or anything.

How can I see or change the alleged "address" (URL) of a sub-module?

Regards.
Last edited on
cat .gitmodules
If starting from scratch, you need:
git submodule update --init --recursive
^^ I have to run that every time I swap branches, not just on startup, to be sure the branch and its sm versions are in synch.
cat .gitmodules

Thanks. But the repository does not have a .gitmodules file. And that might be the problem here 😕

Strangely, Git doesn't complain about the missing file.

But I wonder: How did it ever work?

(Before you ask: I already tried contacting the person who created the repo, but to no avail)

If starting from scratch, you need:
git submodule update --init --recursive

I think this should not be needed, if we have used the "--recursive" flag with the clone command already.

Anyways, I tried git submodule update --init --recursive too, but it didn't do anything (also no error message).
Last edited on
But the repository does not have a .gitmodules file. And that might be the problem here

Indeed there must be this file present for git to know about submodules, I have repo with one submodule and the file is present.

I however cloned normally, there was no need submodule --recursive flag.

Do you have latest git version? I know that recent git simplified submodule management, for more info see:

https://github.blog/2016-02-01-working-with-submodules
Registered users can post here. Sign in or register to post.