fatal: in unpopulated submodule
Solution 1:
It seems like, you may have removed the .git
folder. In that case you can try
git rm --cached angulartest -f
Solution 2:
git rm --cached . -rf
Stealing from anlijudavid's comment which was the actual answer for me on macOS with zsh. Adding -r based on Richard Collette's comment to this answer.
Solution 3:
The root cause of this error in my case was that I have a subdirectory with its own .git
folder inside. When I issued the git add --all
command, I got this same error
Here's how I resolved the issue
- Remove all
.git
folder inside the sub directory causing the error -
cd
to the main directory git rm --cached sub_directory_name -f
-
git add --all
to add the subdirectory and contents, recursively -
git status
to verify that the items are added
I almost got a headache with this error but thanks for the previous answers, a combination of those worked for me.
Solution 4:
Here's what I did
- Make a copy of the 'submodule' directory somewhere outside of the repository (e.g. your desktop)
- Delete the submodule directory from your repo
- Commit the repo
- Go into the copy you made of your submodule directory, delete
.gitignore
file and.git
directory - Copy the submodule directory back into your repo and commit
This meant I lost the commit history of the submodule but at least it fixed the issue of my files in the submodule not going to git!