I'm building a WordPress site with a git repo in the root directory, as well as the theme root. (This isn't an ideal setup - don't ask!)
I can't get the outer repo to "see" the submodule. On Gitlab, the theme in question can be found in the site root repo, but clicking on the folder leads to the theme root repo. On the server, the theme exists as an empty directory.
I've run (company names excluded for privacy):
git rm --cached wp-content/themes/salient-child/ (untrack submodule)
git submodule add git@gitlab.com:xxxx-sites/xxxx.git ./wp-content/themes/salient-child
(explicitly add submodule as such)
and pushed the newly created .gitmodules file to the site, but I still can't find the submodule on gitlab or the server.
What do I do now? Thanks for your help!
I can't say for sure what caused the issue, but I found a way around it. Mine is a maybe a pretty specific use-case - one repo is in the site root, and the other in the theme root - so if that's not your setup, follow at your own risk.
Remove the submodule:
git submodule deinit -f <path-to-submodule>
(this will remove all the files in the submodule - NO trailing slash)git rm .gitmodules
Add it back:
git clone <repo-url>
cd ..
git add <path-to-submodule>
Now, the outer repo will track the theme, and the inner repo will work as normal.