Search code examples
windowsgitgit-submodules

Is it possible to add a git submodule with recursive flag?


I am adding a submodule to my project which contains another git repo.

To get the module I ran:

git submodule add git://github.com/biakaveron/debug-toolbar.git modules/debug-toolbar

Then ran:

git submodule update --init --recursive

Which generated this error:

fatal: Not a git repository: ../../../../../../..//d/websites/project/.git/modules/modules/debug-toolbar/modules/vendor/firephp
Failed to recurse into submodule path 'modules/debug-toolbar'

I have run into similar problems before. Previously I just added the submodule and then re-cloned the project with the recursive flag (git clone --recursive project.git) which works. However it would be easier if I could get the submodule to pull in recursively in the first place. Is there a way to do this?


Solution

  • One possible cause could be the fact that github.com/cadorn/firephp-libs mentions:

    THIS PROJECT HAS MOVED TO THE FOLLOWING REPOSITORIES:

    https://github.com/firephp/firephp
    https://github.com/firephp/firephp-core
    

    So you might want to update the .gitmodules file of debug-toolbar first (after a git submodule update --init, without the --recursive part), and then, try again the git submodule update --init --recursive)

    The OP did:

    committing, then a recursive clone - which worked.


    Original answer:

    It seems that the path definition for one of the submodules (in the .gitmodules file) is not correct:
    Being a relative path, it won't resolve successfully when cloned/updated by a git submodule --recursive command done from a parent repo for which said relative path is invalid.