The reason is: the corresponding directory or file has been submitted before , and has been tracked by git, so adding. Gitignore is invalid
The following solution is only applicable to this situation, you need to go to the server to verify
Solutions
git rm -rf .idea;
git commit -m "delete .idea";
git push;
If you are prompted that the file has been modified, you can cache it, or directly – f force delete it:
git rm --cached DayTest.iml;
git rm -f DayTest.iml;
Confirm to delete the warehouse file
Add more ignore