npm-debug.log 在 .gitignore 文件中,但我仍然收到消息 "nothing added to commit but untracked files present (use "git add" to track)"
npm-debug.log is in .gitignore file, but I still get the messsage "nothing added to commit but untracked files present (use "git add" to track)"
我的 gitignore 文件如下所示:
*.csv
*.dat
*.iml
*.log
*.out
*.pid
*.seed
*.sublime-*
*.swo
*.swp
*.tgz
*.xml
.DS_Store
.idea
.project
.strong-pm
coverage
node_modules
npm-debug.log
server-info
definitions/
然而,突然 git status
向我显示了很多红色的 npm-debug.log 文件。
我也收到消息
nothing added to commit but untracked files present (use "git add" to
track)
如何从我的本地计算机中删除所有 npm-debug.log 文件而不意外删除任何重要文件?
此外,如何首先阻止创建这些文件?
您需要将 npm-debug.log*
添加到您的 .gitignore
文件,因为 .gitignore
文件的当前状态仅表示 npm-debug.log
。
添加星号 *
将确保忽略任何以 npm-debug.log
开头的文件
如果您想从您的机器上永久删除它们,请使用以下命令:
rm -f npm-debug.log.*
要忽略 Git 上的 npm-debug 文件,您在 .gitignore 文件中的字符串末尾缺少一个星号。
npm-debug.log*
如果您不想生成这些日志,可以使用 --loglevel=silent
执行安装,无论如何我不建议这样做,它们可能会有用。
我的 gitignore 文件如下所示:
*.csv
*.dat
*.iml
*.log
*.out
*.pid
*.seed
*.sublime-*
*.swo
*.swp
*.tgz
*.xml
.DS_Store
.idea
.project
.strong-pm
coverage
node_modules
npm-debug.log
server-info
definitions/
然而,突然 git status
向我显示了很多红色的 npm-debug.log 文件。
我也收到消息
nothing added to commit but untracked files present (use "git add" to track)
如何从我的本地计算机中删除所有 npm-debug.log 文件而不意外删除任何重要文件?
此外,如何首先阻止创建这些文件?
您需要将 npm-debug.log*
添加到您的 .gitignore
文件,因为 .gitignore
文件的当前状态仅表示 npm-debug.log
。
添加星号 *
将确保忽略任何以 npm-debug.log
开头的文件
如果您想从您的机器上永久删除它们,请使用以下命令:
rm -f npm-debug.log.*
要忽略 Git 上的 npm-debug 文件,您在 .gitignore 文件中的字符串末尾缺少一个星号。
npm-debug.log*
如果您不想生成这些日志,可以使用 --loglevel=silent
执行安装,无论如何我不建议这样做,它们可能会有用。