-
Notifications
You must be signed in to change notification settings - Fork 856
.gitignore for node_modules? #25
Comments
You can create your own .gitignore which ignores itself. Create a .gitignore with this two records:
|
Thanks, I think it would be easier for new users and contributors to have this .gitignore bundled with the code, so that they don't have to add it themselves. |
Closes harthur#25 * Ignores the node_modules directory because it's not needed in the repository. * Ignores the DS_STORE file on Mac because it's pointless committing that every time. * Ignores npm log file because it's unnecessary to store that in the repository.
You can create your own .gitignore file and add the folders/file names you want to exclude from your git repositories in production. |
To create .gitignore file use touch command user-name$ touch .gitignore .gitignore it will work. |
Seems not to work with subfolders. I have the following directory structure:
By simply adding |
In your root folder within the .gitignore file, you need to write *node_modules to ignore the node_modules folder under any sub folder. |
@rrajvanshi1947 Just "node_modules" without a / at the start will do that too. (.gitignore ignores the listed files in any directory, unless they start with /, in which case the line is expected to be the relative path to a file.) |
For me, it worked |
Thank you! |
I saw a great answer on StackOverflow by a fellow programmer (https://stackoverflow.com/users/2854041/andrew-schreiber). He wrote: |
hello |
Cual debería ser el modo correcto de guardar node_modules en mi proyecto, ¿Dentro o fuera del .git ignore? |
When I fork this repo, and do "npm install", the folder is filled with node_modules, and since there is no .gitignore, git tries to commit them...
From what I read, there are two options for handling node_modules in git projects:
A. Keep all the node_modules in the git repository, together with my project, or:
B. Don't keep any node_modules in the git repository, and have a ".gitignore" file that contains "node_modules".
However, here, there are no node_modules, but also no .gitignore file...
I am not an expert, so maybe it's my mistake.
The text was updated successfully, but these errors were encountered: