[英]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文件。
我也收到消息
沒有添加任何內容提交但存在未跟蹤的文件(使用“ git add”進行跟蹤)
如何從本地計算機上刪除所有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
執行安裝,無論如何,我不建議這樣做,它們可能會很有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.