1

my git is not ignoring some files and folder.
this is my git status

deleted:    storage/app/some_folder/700

700 is a file, without extension

my .gitignore

/storage/*.key
/storage/app/
Ranjan Adhikari
  • 251
  • 1
  • 11
  • 1
    `.gitignore` does not mean *ignore* a file, it means *don't complain about the file being untracked* and *don't automatically add the file when using an en-masse "add many" operation*. A *tracked* file (which is now in the index/staging-area) cannot be ignored, it has to be explicitly removed (using `git rm`) from the index/staging-area. – torek Jul 22 '18 at 17:02

2 Answers2

4

When you have added your files first it's insight the git repo and tracked until you remove the files. So remove the files first and then your files are ignored.

git rm --cached yourfiles

Then your files are removed for the next commit but still present in your folder. Then you can add the deleted files and they are removed.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
0

Your .gitignore is ignoring the folder, but not the files within it. As far as git is concerned, folders aren't even real! Add a wildcard to get it to ignore the contents of the folder:

/storage/*.key
/storage/app/*
wizzwizz4
  • 6,140
  • 2
  • 26
  • 62
  • Somebody keeps downvoting all the answers I post within 30 seconds of posting them. Cut it out please. I appreciate that this one might be wrong, since ot's based on a vague recollection, but it would be nice if you'd told me that. – wizzwizz4 Jul 22 '18 at 16:13