0

I have a javascript application with eslint set-up and the needed Node modules, all in the same project folder. Node is only used so that eslint works.

The whole thing is pushed to GitHub and I'm noticing now the whole node-modules is getting uploaded with it (17mb approx), again I'm just using node for eslint only.

I feel like I'm doing something wrong and that I have set-up my project incorrectly. Should I be using .ignore here in git or something else, or I'm I overthinking this.

Thanks

Tristan Forward
  • 3,304
  • 7
  • 35
  • 41

2 Answers2

2

Create a .gitignore file at the root of your project. Add node_modules to it. Remove the node_modules folder from your local repo. Recommit the changes. Then push up again.

Then run npm i on your terminal/command line to get the eslint packages back on your local computer. Now the directory will no longer be pushed on future commits.

Govind Rai
  • 14,406
  • 9
  • 72
  • 83
0

You should use .gitignore for pushing redundant file to your repo here

https://git-scm.com/docs/gitignore

Here is the sample .gitignore file for Node from github

https://github.com/github/gitignore/blob/master/Node.gitignore

yue you
  • 2,206
  • 1
  • 12
  • 29