fatal: invalid gitfile format

Shell
sudo rm directoryname/.git/

Source

Also in Shell: