tulipe tulipe -4 years ago 87
Git Question

Add Sub Module Error Message

I am trying to follow instructions on the following link to add a submodule on an already existing path(repo/SubContainer) that contains other sub-modules but each time I add it I get error message "SubContainer already exists in the index".
My Folder Structure:

repo
--SubContainer
--Sub1

Answer Source

You can not add a submodule to a folder where another submodule exists. SubContainer already exists in the index means that a submodule in the place you provided is already part of the index. Each submodule has to have its own folder. like this:

repo
  --SubContainer
    --Sub1
    --Sub2

So if you add a submodule, you have to add it in path SubContainer/SubX. The corresponding command-line command would be git submodule add <Submodule URL> SubContainer/SubX. It does not suffice to provide the SubContainer path; git will not automatically create a folder for the submodule in the SubContainer folder. A new folder is only created if you do not provide a path at all.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download