How do I add files in Git to the path of a former submodule?

Git still think mysubmodule is a submodule, because it is recorded in the index with a special mode “160000”.
See “git submodule update needed only initially?” for more.
To check that, as in in this answer, you can do a:

 $ git ls-tree HEAD mysubmodule 
 160000 commit c0f065504bb0e8cfa2b107e975bb9dc5a34b0398  mysubmodule 

That doesn’t depend on the presence of the .gitmodule file, or on the content of mysubmodule.

You need to remove that entry from the index first:

 git rm --cached mysubmodule

Then you can proceed.

Leave a Comment