The reason is invalid: 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.
Solution
git rm -rf .idea;
git commit -m "delete .idea";
git push;
If the prompt file has been modified, you can cache it, or directly -f force deletion:
git rm --cached DayTest.iml;
git rm -f DayTest.iml;
After confirming that the files in the warehouse are deleted
add ignore