我一直遇到 .gitignore 没有忽略我的 node_modules 目录的问题。
这是我的 .gitignore 文件:
*~
~*
*.log
images/
images/*
images/**/*
.idea/
.idea/*
import_errors/
output/
output/*
node_modules/
node_modules/*
uploads/
downloads/
tmp/
.DS_Store
!.keep
!*/
我还尝试运行命令来更新 git-index 并从索引中删除文件夹
$ git rm --cached node_modules
fatal: pathspec 'node_modules' did not match any files
$ git update-index --assume-unchanged node_modules
fatal: Unable to mark file node_modules
通常我只会发出这两个命令,但我不断收到这些错误。第一个命令应该取消暂存文件,第二个命令应该更新 git 索引以停止跟踪文件。但由于某种原因,这并没有发生,我不知道还有什么可能是错的。