[fix] non working git detection if you are outside root directory

If you are working on a non-root directory path, git detection fails. fixed.