If you create a new text file directly and then modify its file name to .gitmodules, you will get an error: you must type a filename .
Solution:
After opening the text file, then click Save As, and then change the " Save as type " to all Files .
original: