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