diff options
| author | Richard C Gerkin <rick1@gerkin.org> | 2017-11-05 15:43:46 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-05 15:43:46 -0700 | 
| commit | ecd061b2e296a4f48fc9f545ece11c22156749e1 (patch) | |
| tree | 5b3bd743dcf94934065a6a06006d9d91802353c1 /git/remote.py | |
| parent | bfae362363b28be9b86250eb7f6a32dac363c993 (diff) | |
| download | gitpython-ecd061b2e296a4f48fc9f545ece11c22156749e1.tar.gz | |
Update remote.py to fix issue #694
Diffstat (limited to 'git/remote.py')
| -rw-r--r-- | git/remote.py | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/git/remote.py b/git/remote.py index 7261be81..c5990da1 100644 --- a/git/remote.py +++ b/git/remote.py @@ -536,10 +536,18 @@ class Remote(LazyMixin, Iterable):              #    and: http://stackoverflow.com/a/32991784/548792              #              if 'Unknown subcommand: get-url' in str(ex): -                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] +                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 'correct access rights' in str(ex): +                        # 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 | 
