def urls(self):
        """:return: Iterator yielding all configured URL targets on a remote as strings"""
        try:
            remote_details = self.repo.git.remote("get-url", "--all", self.name)
            for line in remote_details.split('\n'):
                yield line
        except GitCommandError as ex:
            ## We are on git < 2.7 (i.e TravisCI as of Oct-2016),
            #  so `get-utl` command does not exist yet!
            #    see: https://github.com/gitpython-developers/GitPython/pull/528#issuecomment-252976319
            #    and: http://stackoverflow.com/a/32991784/548792
            #
            if 'Unknown subcommand: get-url' in str(ex):
                try:
                    remote_details = self.repo.git.remote("show", self.name)
                    for line in remote_details.split('\n'):
                        if '  Push  URL:' in line:
                            yield line.split(': ')[-1]
                except GitCommandError as ex:
                    if any(msg in str(ex) for msg in ['correct access rights', 'cannot run ssh']):
                        # If ssh is not setup to access this repository, see issue 694
                        result = Git().execute(
                            ['git', 'config', '--get', 'remote.%s.url' % self.name]
                        )
                        yield result
                    else:
                        raise ex
            else:
                raise ex
def urls ( self ) : try : remote_details = self . repo . git . remote ( "get-url" , "--all" , self . name ) for line in remote_details . split ( '\n' ) : yield line except GitCommandError as ex : if 'Unknown subcommand: get-url' in str ( ex ) : try : remote_details = self . repo . git . remote ( "show" , self . name ) for line in remote_details . split ( '\n' ) : if '  Push  URL:' in line : yield line . split ( ': ' ) [ - 1 ] except GitCommandError as ex : if any ( msg in str ( ex ) for msg in [ 'correct access rights' , 'cannot run ssh' ] ) : result = Git ( ) . execute ( [ 'git' , 'config' , '--get' , 'remote.%s.url' % self . name ] ) yield result else : raise ex else : raise ex
:return: Iterator yielding all configured URL targets on a remote as strings