Disclaimer: I am a consultant at Amazon Web Services, and this is my personal blog. The opinions expressed here are solely mine and do not reflect the views of Amazon Web Services (AWS). Any statements made should not be considered official endorsements or statements by AWS.
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: