.gitignore not ignoring node_modules
I solved the problem by deleting the file name at .gitignore
and made it an invisible file respectively a dot-file, just like naming the file .gitignore
and keeping the expression
node_modules/
in that file, so that works and now git ignores finally the node-modules directory. Don't know exactly, why this is working, but at least it does.
Even after adding the .gitignore file to the root of the .git repository, I cannot make git ignore the node_modules directory.
The .gitignore
file should be placed in the root of the working tree (also known as the root of your project), which is just above the .git
directory. Inside the .git
directory the file has no effect.
This makes sense, because normally you want to put this file under version control, to share the list of ignored files with all developers on the project. And only the files inside the working tree, outside .git
are under version control, the .git
directory is for Git's internal storage.
(If you wanted to ignore patterns only locally, without adding to version control, you could do so by defining patterns in .git/info/exclude
.)
[...] and also tried adding a comment line to the first line, since apparently Git doesn't read the first line of that file
For the record, it does read the first line too, there's nothing special about the first line in .gitignore
.
I don't know if this will help anyone but I created my .gitignore file in PS with echo "" > .gitignore and thus the encoding was set to UTF-16LE and not UTF-8. This caused problems with .gitignore working properly.