-1

This is my .gitignore page

.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

#dbconnector
dbconnector.js

And it isn't ignoring the dbconnector.js file who is on that specific location

I already tryed this three lines as replacement for dbconnector.js but it doesn't worked

server/dbconnector.js
./server/dbconnector.js
**/dbconnector.js
evolutionxbox
  • 3,932
  • 6
  • 34
  • 51
  • 4
    Was the file added to VCS before it was marked as ignored through the gitignore? – Vivick Aug 16 '23 at 14:19
  • 3
    Is the file untracked? Only untracked files can be ignored. – knittl Aug 16 '23 at 14:25
  • Sorry for the silly question but I'm new to git. How can i know if i added the file to VCS or not? – Lukill 360 Aug 16 '23 at 14:32
  • 3
    Does the file show under "Changes not staged for commit" or "Changes to be committed" in the output of `git status`; or is it listed below "Untracked files"? If the former, it is already tracked (added with `git add` in an earlier commit) – knittl Aug 16 '23 at 14:41

1 Answers1

1

Watch for spurious characters in and around the filename in .gitignore. Do not forget to add newline after the name.

If the file is already tracked, use git rm --cached server/dbconnector.js (precise pathname for each file).

I suppose other files are well git-ignored, so there is no need for a test with a new file, like echo hello >> hello; echo hello >> .gitignore; git status. Thought it does not hurt to take the test.

minorChaos
  • 101
  • 7