node_modules directory is an integral part of any JS project. However, it makes sense
to exclude it from your
git commits. You can remove
the remote repository by adding it to the
When you’re starting a fresh JS project, then excluding
git is very easy.
Create a plain text file called
.gitignore (yes it starts with a dot) in the root
directory of your project and add a single line to it.
Excluding node_modules that have already been committed
node_modules after already having committed them, you should first launch
your terminal and clear
git including cached files and folders.
git rm -r --cached .
Then, go ahead and create a
.gitignore file with the
node_modules string in it.
And voilà! You’re ready to commit your changes without the
git add . git commit -m "Removed node_modules folder and added it to .gitignore" git push