Below, I have mentioned both root-cause & solution of the above error.
It seems that the files you want to ignore are already committed to the repository. And
.gitignore doesn't actually ignore the files which are already committed into the repository.
Note that here untracked working tree files mean that git is considering these files as untracked because
.gitignore file has their entries.
You can fix this issue by the following below easy steps: