7

I'm working with nextjs project on the vscode. From a few days ago, debug.log file generated automatically for any directory where I'm working with. I want to stop generating this debug.log automatically, or at least want to know how to add this debug.log to the gitignore. I added .log, debug.log, **/debug.log, but gitignore don't works.

Yuji
  • 371
  • 1
  • 6
  • 22
  • 1
    There is a known issue in vscode for this that should be fixed this week. The answers below should keep it out of version control, but if you don't want it created then you can read up on: https://github.com/microsoft/vscode/issues/105191 . I was able to fix the issue by only having one instance for vs code running. Hope it helps – rahicks Sep 22 '20 at 17:15
  • @did you figure out how to resolve this issue?? It is very annoying... – Clancinio Nov 09 '20 at 00:56
  • I only reinstalled VSCode 1.51.0(user setup) version. – Yuji Nov 10 '20 at 10:31

5 Answers5

5

Maybe you need to remove cached *.log files in your project by running git rm --cached *.log, then stage your .gitignore file using git add .gitignore or you can use git add .

My reference: How to use gitignore command in git

2

How about adding this below one?

*.log

in your .gitignore file

Sanjay Pradeep
  • 407
  • 5
  • 6
  • Maybe your debug.log has been tracked in last commits. Follow the direction here to refresh the .gitignore https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore – nghiaht Sep 22 '20 at 03:32
1

Make sure "Exclude Git Ignore" is checked in settings:

screenshot

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
alok992
  • 11
  • 1
0

this issue can be resolved by removing the (*).log what that does is make the file editable or not required should end up looking something like this

# Logs
logs
.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

this is specifically for react but it might just work for you

  • Hi @Josh_Hero. Congratulations on your first stackoverflow answer. Well done. I have a question - do you intend to put these entries in `.gitignore`? if so, it might be a good idea to edit your answer and mention that so it's clearer to reader. Cheers. – urig Apr 21 '21 at 05:37
0

uninstall then reinstall VScode worked for me.

step1: Go to Path: C:\Program Files\Microsoft VS Code

step2: run unins000.exe

step3: download and install VScode https://code.visualstudio.com/download

HungNM2
  • 3,101
  • 1
  • 30
  • 21