None of the mentioned .gitignore statements actually seem to work (not the one in the article nor then ones in the comments). Is it possible that you installed only packages with tags and have the prefer-dist flag on so there are no .git folders in the first place?
My starting point is a project that has vendor/ in gitignore. So nothing in the vendor folder is originally under version control.
and then doing a
[code]git add . --all[/code]
adds dependencies with a .git folder as submodules.