@Override
    public Collection<RegisteredService> load() {
        return lock.tryLock(() -> {
            try {
                if (gitRepository.pull()) {
                    LOGGER.debug("Successfully pulled changes from the remote repository");
                } else {
                    LOGGER.info("Unable to pull changes from the remote repository. Service definition files may be stale.");
                }
                val objectPatternStr = StringUtils.isBlank(rootDirectory)
                    ? GitRepositoryRegisteredServiceLocator.PATTEN_ACCEPTED_REPOSITORY_FILES
                    : rootDirectory + '/' + GitRepositoryRegisteredServiceLocator.PATTEN_ACCEPTED_REPOSITORY_FILES;
                val objectPattern = RegexUtils.createPattern(objectPatternStr, Pattern.CASE_INSENSITIVE);
                val objects = gitRepository.getObjectsInRepository(
                    new PathRegexPatternTreeFilter(objectPattern));
                registeredServices = objects
                    .stream()
                    .filter(Objects::nonNull)
                    .map(this::parseGitObjectContentIntoRegisteredService)
                    .flatMap(Collection::stream)
                    .map(this::invokeServiceRegistryListenerPostLoad)
                    .filter(Objects::nonNull)
                    .collect(Collectors.toList());
                return registeredServices;
            } catch (final Exception e) {
                LoggingUtils.warn(LOGGER, e);
                val parentDir = StringUtils.isBlank(rootDirectory)
                    ? gitRepository.getRepositoryDirectory()
                    : new File(gitRepository.getRepositoryDirectory(), rootDirectory);
                val files = FileUtils.listFiles(parentDir,
                    GitRepositoryRegisteredServiceLocator.FILE_EXTENSIONS.toArray(ArrayUtils.EMPTY_STRING_ARRAY), true);
                LOGGER.debug("Located [{}] files(s)", files.size());

                registeredServices = files
                    .stream()
                    .filter(file -> file.isFile() && file.canRead() && file.canWrite() && file.length() > 0)
                    .map(Unchecked.function(file -> {
                        try (val in = Files.newBufferedReader(file.toPath())) {
                            return registeredServiceSerializers
                                .stream()
                                .filter(s -> s.supports(file))
                                .map(s -> s.load(in))
                                .filter(Objects::nonNull)
                                .flatMap(Collection::stream)
                                .map(this::invokeServiceRegistryListenerPostLoad)
                                .filter(Objects::nonNull)
                                .collect(Collectors.toList());
                        } catch (final Exception ex) {
                            LOGGER.error("Error reading configuration file [{}]", file.toPath());
                            LoggingUtils.error(LOGGER, ex);
                        }
                        return new ArrayList<RegisteredService>();
                    }))
                    .flatMap(List::stream)
                    .sorted()
                    .map(this::invokeServiceRegistryListenerPostLoad)
                    .filter(Objects::nonNull)
                    .collect(Collectors.toList());
                return registeredServices;
            }
        });
    }
This is {@link GitServiceRegistry}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-git-service-registry/src/main/java/org/apereo/cas/services/GitServiceRegistry.java