The .gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root directory of your repo. You can have multiple .gitignore files as well in one folder
If your project has multiple projects internally and you have to ignore node_mofules of all the projects then you have 2 options.