clearml_agent/helper/repo.py
def _set_ssh_url(self):
        """
        Replace instance URL with SSH substitution result and report to log.
        According to ``man ssh-add``, ``SSH_AUTH_SOCK`` must be set in order for ``ssh-add`` to work.
        """
        if self.session.config.get('agent.force_git_ssh_protocol', None) and self.url:
            parsed_url = furl(self.url)
            # only apply to a specific domain (if requested)
            config_domain = \
                ENV_AGENT_GIT_HOST.get() or self.session.config.get("agent.git_host", None)
            if config_domain and config_domain != parsed_url.host:
                return
            if parsed_url.scheme == "https":
                new_url = self.replace_http_url(
                    self.url,
                    port=self.session.config.get('agent.force_git_ssh_port', None),
                    username=self.session.config.get('agent.force_git_ssh_user', None)
                )
                if new_url != self.url:
                    print("Using SSH credentials - replacing https url '{}' with ssh url '{}'".format(
                        self.url, new_url))
                    self.url = new_url
                return
            # rewrite ssh URLs only if either ssh port or ssh user are forced in config
            if parsed_url.scheme == "ssh" and (
                self.session.config.get('agent.force_git_ssh_port', None) or
                self.session.config.get('agent.force_git_ssh_user', None)
            ):
                new_url = self.rewrite_ssh_url(
                    self.url,
                    port=self.session.config.get('agent.force_git_ssh_port', None),
                    username=self.session.config.get('agent.force_git_ssh_user', None)
                )
                if new_url != self.url:
                    print("Using SSH credentials - ssh url '{}' with ssh url '{}'".format(
                        self.url, new_url))
                    self.url = new_url

        if not self.session.config.agent.translate_ssh:
            return

        # if we have git_user / git_pass replace ssh credentials with https authentication
        if (ENV_AGENT_GIT_USER.get() or self.session.config.get('agent.git_user', None)) and \
                (ENV_AGENT_GIT_PASS.get() or self.session.config.get('agent.git_pass', None)):
            # only apply to a specific domain (if requested)
            config_domain = \
                ENV_AGENT_GIT_HOST.get() or self.session.config.get("git_host", None)
            if config_domain and config_domain != furl(self.url).host:
                return

            new_url = self.replace_ssh_url(self.url)
            if new_url != self.url:
                print("Using user/pass credentials - replacing ssh url '{}' with https url '{}'".format(
                    self.url, new_url))
                self.url = new_url

        Replace instance URL with SSH substitution result and report to log.
        According to ``man ssh-add``, ``SSH_AUTH_SOCK`` must be set in order for ``ssh-add`` to work.
        
Replace instance URL with SSH substitution result and report to log.
Replace instance URL with SSH substitution result and report to log .
def _set_ssh_url(self):
        if self.session.config.get('agent.force_git_ssh_protocol', None) and self.url:
            parsed_url = furl(self.url)
            config_domain = \
                ENV_AGENT_GIT_HOST.get() or self.session.config.get("agent.git_host", None)
            if config_domain and config_domain != parsed_url.host:
                return
            if parsed_url.scheme == "https":
                new_url = self.replace_http_url(
                    self.url,
                    port=self.session.config.get('agent.force_git_ssh_port', None),
                    username=self.session.config.get('agent.force_git_ssh_user', None)
                )
                if new_url != self.url:
                    print("Using SSH credentials - replacing https url '{}' with ssh url '{}'".format(
                        self.url, new_url))
                    self.url = new_url
                return
            if parsed_url.scheme == "ssh" and (
                self.session.config.get('agent.force_git_ssh_port', None) or
                self.session.config.get('agent.force_git_ssh_user', None)
            ):
                new_url = self.rewrite_ssh_url(
                    self.url,
                    port=self.session.config.get('agent.force_git_ssh_port', None),
                    username=self.session.config.get('agent.force_git_ssh_user', None)
                )
                if new_url != self.url:
                    print("Using SSH credentials - ssh url '{}' with ssh url '{}'".format(
                        self.url, new_url))
                    self.url = new_url
        if not self.session.config.agent.translate_ssh:
            return
        if (ENV_AGENT_GIT_USER.get() or self.session.config.get('agent.git_user', None)) and \
                (ENV_AGENT_GIT_PASS.get() or self.session.config.get('agent.git_pass', None)):
            config_domain = \
                ENV_AGENT_GIT_HOST.get() or self.session.config.get("git_host", None)
            if config_domain and config_domain != furl(self.url).host:
                return
            new_url = self.replace_ssh_url(self.url)
            if new_url != self.url:
                print("Using user/pass credentials - replacing ssh url '{}' with https url '{}'".format(
                    self.url, new_url))
                self.url = new_url
def _set_ssh_url ( self ) : if self . session . config . get ( 'agent.force_git_ssh_protocol' , None ) and self . url : parsed_url = furl ( self . url ) config_domain = ENV_AGENT_GIT_HOST . get ( ) or self . session . config . get ( "agent.git_host" , None ) if config_domain and config_domain != parsed_url . host : return if parsed_url . scheme == "https" : new_url = self . replace_http_url ( self . url , port = self . session . config . get ( 'agent.force_git_ssh_port' , None ) , username = self . session . config . get ( 'agent.force_git_ssh_user' , None ) ) if new_url != self . url : print ( "Using SSH credentials - replacing https url '{}' with ssh url '{}'" . format ( self . url , new_url ) ) self . url = new_url return if parsed_url . scheme == "ssh" and ( self . session . config . get ( 'agent.force_git_ssh_port' , None ) or self . session . config . get ( 'agent.force_git_ssh_user' , None ) ) : new_url = self . rewrite_ssh_url ( self . url , port = self . session . config . get ( 'agent.force_git_ssh_port' , None ) , username = self . session . config . get ( 'agent.force_git_ssh_user' , None ) ) if new_url != self . url : print ( "Using SSH credentials - ssh url '{}' with ssh url '{}'" . format ( self . url , new_url ) ) self . url = new_url if not self . session . config . agent . translate_ssh : return if ( ENV_AGENT_GIT_USER . get ( ) or self . session . config . get ( 'agent.git_user' , None ) ) and ( ENV_AGENT_GIT_PASS . get ( ) or self . session . config . get ( 'agent.git_pass' , None ) ) : config_domain = ENV_AGENT_GIT_HOST . get ( ) or self . session . config . get ( "git_host" , None ) if config_domain and config_domain != furl ( self . url ) . host : return new_url = self . replace_ssh_url ( self . url ) if new_url != self . url : print ( "Using user/pass credentials - replacing ssh url '{}' with https url '{}'" . format ( self . url , new_url ) ) self . url = new_url
Replace instance URL with SSH substitution result and report to log.
Replace instance URL with SSH substitution result and report to log .
"""
        Replace instance URL with SSH substitution result and report to log.
        According to ``man ssh-add``, ``SSH_AUTH_SOCK`` must be set in order for ``ssh-add`` to work.
        """ # only apply to a specific domain (if requested) # rewrite ssh URLs only if either ssh port or ssh user are forced in config # if we have git_user / git_pass replace ssh credentials with https authentication # only apply to a specific domain (if requested)
self