繁体   English   中英

git 不忽略 node_modules 文件夹

[英]git not ignoring node_modules folder

目前 git 没有忽略 node_modules 文件夹。 我试过下面的命令:

git rm -r --cached node_modules

上面一行的输出:

致命:路径规范“node_modules”与任何文件都不匹配

当我运行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)

下次运行git add .时,我不想包含我的node_modules/文件夹git add . . 目前它正在添加node_modules/文件夹中的所有文件。

您需要在 node_modules 所在的同一目录中添加.gitignore文件

把这个放在里面

# dependencies
/node_modules

暂无
暂无

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

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