0

Sorry if it sounds like a very simple question. But I'm still beginner. I already ignored .gitignore file itself and everything inside .idea folder. This is my .gitignore file:

\.gitignore
.idea/**

I'm working on a web project and trying to ignore a single file within a folder: config/db.php

but can't reach it. Appreciate any help!

Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
Scott
  • 4,974
  • 6
  • 35
  • 62

2 Answers2

2

First, it seems that you’ve already committed the files which you want to ignore. In that case, do:

git rm -rf -—cached .idea/ config/db.php

Next, correct your .gitignore file to have the following entries:

.gitignore
.idea/
config/db.php

Now, commit the changes in your .gitignore file:

git add .gitignore && git commit -m “Correct ignore files”
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
0

You are probably already tracking the file. From the man page:

Files already tracked by Git are not affected;

So you first need to remove the file, and if you try to commit it again, you will get a warning.

andipla
  • 363
  • 4
  • 9