I had this problem, I could not fix it, but I was able to transfer my project to a new repository. Start by deleting the .git folder inside the project folder. Also be sure to check any .git folders in your Java folders. In my opinion, they are hidden by default, so you can enable the display of hidden files. After that, return to Android Studio, and it will tell you that some changes have occurred, and click "Configure." It will open the settings window, delete these elements in red text. Now it should be ready so that you can import into version control from the very beginning. I personally used these steps https://www.londonappdeveloper.com/how-to-use-git-hub-with-android-studio/
source share