Learn how to remove node_modules after they have been added to a remote repository.
How do you delete
node_modules from your remote git repository if you added your .gitignore file after you already pushed your
You might expect that your
node_modules directory will automatically get deleted on your next push since you put it in your
.gitignore file, right?
You have to remove the node_modules folder from the git repository first (right after creating your
git rm -r --cached node_modules
Now you can commit your repository without node_modules:
git commit -m "Removed node_modules"
And push your changes:
git push origin master
Now node_modules will get deleted from your remote repository.