Fix · GitHub and Git
The repository is huge because node_modules was saved
What you may see
- Pushing takes forever and the repository is hundreds of megabytes
- GitHub shows thousands of files in node_modules
Most likely cause
The generated folder node_modules was committed, but it can be rebuilt with npm install and should never be saved.
Check first (about two minutes)
- Run git ls-files | grep -c node_modules to count the saved files.
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- Add node_modules (and .next, dist, .env) to .gitignore.
- Stop tracking them but keep them on disk: git rm -r --cached node_modules, then commit.
- Explain that old commits still carry the weight and offer, but do not run, a history clean-up if the size is a problem.
Do not do this
- Do not rewrite history on a shared branch without asking.
- Do not delete node_modules before confirming package.json lists every dependency.