Fix bug that accepted invalid .git directories