How to disconnect git for a project in intellij?
Open the Setting and Click "Version Control then make selected project VCS as None.
I guess that this could be a duplicate, you can find at least the first part of your question here
After that you remove VCS, you would be able to remove .git directory without any problem