Fix issue where git repository was detected when it shouldn't

(since somewhere up the directory tree a git repository exists)