I have a project A which is a library and it is used in a project B.
Both projects A and B have a separate repository on github BUT inside B we have a submodule of A
None of the above answers worked for me.
This was the solution, from the parent directory run:
git submodule update --init; cd submodule-directory; git pull; cd ..; git add submodule-directory;
now you can git commit and git push
git commit
git push