[英]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)”
My gitignore file looks like this: 我的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/
Yet, suddenly git status
shows me a lot of npm-debug.log files in red. 但是,突然
git status
向我显示了很多红色的npm-debug.log文件。
I also get the message 我也收到消息
nothing added to commit but untracked files present (use "git add" to track)
没有添加任何内容提交但存在未跟踪的文件(使用“ git add”进行跟踪)
How do I remove all the npm-debug.log files from my local machine without accidentally deleting any important files? 如何从本地计算机上删除所有npm-debug.log文件,而又不小心删除任何重要文件?
Also, how do I prevent these files from being created in the first place? 另外,如何防止首先创建这些文件?
You need to add npm-debug.log*
to your .gitignore
file, because the current status of the .gitignore
file means npm-debug.log
only. 您需要添加
npm-debug.log*
你.gitignore
文件,因为当前状态.gitignore
文件意味着npm-debug.log
只。
Adding asterisk *
will ensure that any file starting with npm-debug.log
will be ignored 添加星号
*
将确保以npm-debug.log
开头的任何文件都将被忽略
If you want to delete them forever from your machine use the following command: 如果要从计算机上永久删除它们,请使用以下命令:
rm -f npm-debug.log.*
To ignore the npm-debug files on Git you're missing a star at the end of the string in your .gitignore file. 要忽略Git上的npm-debug文件,您需要在.gitignore文件中的字符串末尾缺少星号。
npm-debug.log*
And if you want to never generate those logs, you can execute the install with --loglevel=silent
, anyway I don't recommend to do that, they may be useful. 而且,如果您不希望生成那些日志,则可以使用
--loglevel=silent
执行安装,无论如何,我不建议这样做,它们可能会很有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.