diff options
Diffstat (limited to 'git')
-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..35460f5a 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 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 |