These two commands solved the problem for me:
1- Recursive option that allows you to change the permissions of all files in a directory and its subdirectories:
chmod -R 755 .git/
2- Force deletion of the directory and subdirectories:
rm -rf .git/
Note: You can optionally see a visual confirmation with the command:
rm -vrf .git/