class RepositoryManager {

    public static boolean isGitRepository(Path targetDirectory) {
        Git repository = null;
        try {
            repository = Git.open(targetDirectory.toFile());
            return true;
        } catch (IOException e) {
            return false;
        } finally {
            close(repository);
        }
    }

}