.gitignore file not ignoring the file

C++
git rm -r --cached .
git add .
git commit -m “.gitignore is now working”
Source

Also in C++: