1

PyCharm version 2018.2

No matter what I try, PyCharm still sends node_modules to the git repo.

I want to make a universal exclusion, so that no matter what level of the directory tree, node_modules is excluded from git, but it just doesn't work.

You can see here I have tried every combination to specify.

enter image description here

But when I select "commit directory", you can see from the next screenshot below that it still wants to send all the node_modules files.

Any suggestions?

enter image description here

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Duke Dougal
  • 24,359
  • 31
  • 91
  • 123

2 Answers2

4

It appears that it is better to use gitingore, maybe a global one, than the builtin Ignore list.

And by the way, it is only possible to ignore unversioned files, and if files are already in the added status, as on the screenshot, you need to revert them first to become unversioned.

Dmitrii Smirnov
  • 7,073
  • 1
  • 19
  • 29
1
  1. Remove node_modules from index

The index is a single, large, binary file in /.git/index, which lists all files in the current branch, their sha1 checksums, time stamps and the file name -- it is not another directory with a copy of files in it. source

git rm -r --cached node_modules
  1. (optional) if node_modules doesn't exist yet on .gitignore make sure to add it there (right relative path to git project root)

  2. Add changes (without the node_modules) to index and commit

    git add . git commit -am "Remove previously tracked node_modules"

letthefireflieslive
  • 11,493
  • 11
  • 37
  • 61