In this post, we will see how to remove node_modules folder from our repo in Github and bitbucket.
If you have accidentally pushed your
node_modules folder to a remote repository on git, then deleting it locally before your next push, will not delete the folder from the remote repo on Github.
So how can we remove it?
To remove it we have to follow these steps:
Let's follow each step in detail
First, check in your project's root folder if you have a
If you don't, you have to create a
.gitignore file in the root directory.
Next, we have to add the
node_modules folder in the .gitignore file.
.gitignore file and add the following line in the file.
Now, remove/delete the
node_modules folder from the project folder. To do that, run this command
git rm -r --cached node_modules
Or you can run this too
git rm -r --cached .
Now, you can commit the local repository to git without the
git add . git commit -m "remove node module folder"
Then push the code to your remote branch
git push origin master