Use git -C <path> rev-parse. It will return 0 if the directory at <path> is a git repository and an error code otherwise.
Further Reading:
rev-parse-C <path>
Use git -C <path> rev-parse. It will return 0 if the directory at <path> is a git repository and an error code otherwise.
Further Reading:
rev-parse-C <path>