In IntelliJ, How Do I Fix "These Files Do Not Belong to the Project"?

I figured out the problem. The file was still open from before all the shuffling, and was apparently pointing at the original file in its original location! I closed the editor and reopened the file from the project tree without a problem. I hope this helps someone else someday.


This also happened for me when I opened the project through a symlink (parent directory) or when the python interpreter was inside a symlink directory (because of virtualenv).

Reopening through the original directory tree (after fighting hard with the IDE to forget its beloved project settings), solved the issue.


This happened for me when I ignored the .idea/ files. Just do

rm -rf .idea/

And then File -> Invalidate Caches/Restart -> Invalidate And Restart.