Search code examples
gitgit-submodules

Sub-module reference not pushed to remote


I have a project which contains 2 git sub-modules. The first I added no problem and I can see a reference to it in my remote repository like so:

enter image description here

With the second sub-module I followed a similar process:

git submodule add <repo_url> <directory_location>

The submodule project was successfully added locally. The .gitmodules file didn't update automatically so I added the changes myself.

I then used git add . and pushed my changes to the remote repository.

When I look at the remote repository there is no reference to the second submodule like there is with the first.

The other thing I noticed is that my .gitmodules file isn't updated on my remote repository.

How can I go about debugging this?


Solution

  • In my case the problem was completely unrelated to submodules specifically.

    I had a .gitignore file inside a sub-directory that was referencing folder name like so:

    puppetdb/
    

    As my second sub-module folder shared this same name it caused problems with updating the .gitmodules file.

    I changed it to read:

    ./puppetdb/
    

    Which only referenced the specific instance I intended to ignore.