- Check for an existing
.gitignore
file in the project directory
ls -a
- If your project directory has a
.gitingore
file - skip to step 3. Otherwise, continue with:
Create a .gitignore
file in the git repository
touch .gitignore
- Open up the
.gitignore
and add the following line to the file
**/node_modules
- Remove the
node_modules
folder from the git repository
git rm -r --cached node_modules
- Commit the git repository without the
node_modules
folder
git commit -m "Removed node_modules folder"
- Push the change to the remote repo
git push origin main
- Commit the
.gitignore
file
git add .gitignore
git commit -m "Updated the .gitignore file"
git push origin main
Superb. Worked for me in 1st time. Thanks a lot.