简体   繁体   English

git 不忽略 node_modules 文件夹

[英]git not ignoring node_modules folder

Currently git is not ignoring node_modules folder.目前 git 没有忽略 node_modules 文件夹。 I have tried below command:我试过下面的命令:

git rm -r --cached node_modules

Output of above line:上面一行的输出:

fatal: pathspec 'node_modules' did not match any files致命:路径规范“node_modules”与任何文件都不匹配

When I run git status I get the following output:当我运行git status我得到以下输出:

$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        configs/
        node_modules/
        package-lock.json
        package.json
        routes/
        server.js

nothing added to commit but untracked files present (use "git add" to track)

I don't want to include my node_modules/ folder the next time I run git add .下次运行git add .时,我不想包含我的node_modules/文件夹git add . . . Currently it is adding all the files from node_modules/ folder.目前它正在添加node_modules/文件夹中的所有文件。

You need to add .gitignore file in same directory where are node_modules您需要在 node_modules 所在的同一目录中添加.gitignore文件

and put this inside把这个放在里面

# dependencies
/node_modules

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM