def init_remotes(self, remotes, per_remote_overrides):
        # The global versions of the auth params (gitfs_user,
        # gitfs_password, etc.) default to empty strings. If any of them
        # are defined and the provider is not one that supports auth, then
        # error out and do not proceed.
        override_params = copy.deepcopy(per_remote_overrides)
        global_auth_params = [
            '{0}_{1}'.format(self.role, x) for x in AUTH_PARAMS
            if self.opts['{0}_{1}'.format(self.role, x)]
        ]
        if self.provider in AUTH_PROVIDERS:
            override_params += AUTH_PARAMS
        elif global_auth_params:
            msg = (
                '{0} authentication was configured, but the \'{1}\' '
                '{0}_provider does not support authentication. The '
                'providers for which authentication is supported in {0} '
                'are: {2}.'.format(
                    self.role, self.provider, ', '.join(AUTH_PROVIDERS)
                )
            )
            if self.role == 'gitfs':
                msg += (
                    ' See the GitFS Walkthrough in the Salt documentation '
                    'for further information.'
                )
            log.critical(msg)
            failhard(self.role)

        per_remote_defaults = {}
        for param in override_params:
            key = '{0}_{1}'.format(self.role, param)
            if key not in self.opts:
                log.critical(
                    'Key \'{0}\' not present in global configuration. This is '
                    'a bug, please report it.'.format(key)
                )
                failhard(self.role)
            per_remote_defaults[param] = six.text_type(self.opts[key])

        self.remotes = []
        for remote in remotes:
            repo_obj = self.provider_class(
                self.opts,
                remote,
                per_remote_defaults,
                override_params,
                self.cache_root,
                self.role
            )
            if hasattr(repo_obj, 'repo'):
                # Strip trailing slashes from the gitfs root as these cause
                # path searches to fail.
                repo_obj.root = repo_obj.root.rstrip(os.path.sep)
                # Sanity check and assign the credential parameter
                repo_obj.verify_auth()
                if self.opts['__role'] == 'minion' and repo_obj.new:
                    # Perform initial fetch
                    repo_obj.fetch()
                self.remotes.append(repo_obj)

        # Don't allow collisions in cachedir naming
        cachedir_map = {}
        for repo in self.remotes:
            cachedir_map.setdefault(repo.cachedir, []).append(repo.id)
        collisions = [x for x in cachedir_map if len(cachedir_map[x]) > 1]
        if collisions:
            for dirname in collisions:
                log.critical(
                    'The following {0} remotes have conflicting cachedirs: '
                    '{1}. Resolve this using a per-remote parameter called '
                    '\'name\'.'.format(
                        self.role,
                        ', '.join(cachedir_map[dirname])
                    )
                )
                failhard(self.role)

        if any(x.new for x in self.remotes):
            self.write_remote_map()
Initialize remotes
dataset/ETHPy150Open saltstack/salt/salt/utils/gitfs.py/GitBase.init_remotes