git submodule init does absolutely nothing

I have a strange problem with “git submodule init”

When I added the submodules using “git submodule add url location” it cloned the repository just fine and everything was ok.

  • why is vc-git and magit in emacs ignoring my git config settings?
  • .git/info/exclude replacement for git submodule?
  • Using Git Flow, the successful branching model
  • Changing the Git username
  • TortoiseGit: How can I see a list of commits that are about to be pushed
  • Accessing git submodule in Android Studio
  • When I pushed all my changes back to the parent repository, added the .gitmodules files, etc and cloned the repository back, I tried to initialise all the submodules using “git submodule init”

    And nothing happens 🙁 Literally nothing, no output, no extra files, it does not even attempt to do anything actually.

    So I am wondering, what did I do wrong?


    bash$ cat .gitmodules
    [submodule "projects/subprojectA"]
        path = projects/subprojectA
        url = ssh://
    [submodule "projects/subprojectB"]
        path = projects/subprojectB
        url = ssh://

  • Android Studio: Can't start Git
  • Zsh dynamic expand to current git root
  • Cannot delete GIT tag because of special character “Ô
  • Git - how to track untracked content?
  • Git push to non-bare repository confusion
  • Am I using Git in Eclipse the right way?
  • 2 Solutions collect form web for “git submodule init does absolutely nothing”

    ok, I have figured out what I did wrong.

    When I added the git submodules, I did a git status and it told me three things had changed


    when I was pushing all my changes to the repository, I didnt want to commit the submodules, cause I thought it would add all the files I just cloned, so I just did a git add .gitmodules and committed and pushed that.

    But this is wrong, you need to do a git commit and commit everything it tells you, then when you do this, git registers those paths and when you clone, it will work.

    but if you do not commit those folders, it wont register them and wont clone them when you clone the parent repository.

    so that was my mistake, I misunderstood that adding those directories would add all the submodules code to the parent repository, I tried to sidestep that and it stopped working.

    so just add your submodules and commit the results, it will all work out just fine 😀

    Thanks for Protectators help, regardless!

    Use the --recursive option when cloning. This option initializes all listed submodules :

    git clone --recursive

    In another case, if you want to initialize submodules of an git you just cloned, you can use

    git submodule update --init --recursive
    Git Baby is a git and github fan, let's start git clone.