From ecd061b2e296a4f48fc9f545ece11c22156749e1 Mon Sep 17 00:00:00 2001 From: Richard C Gerkin Date: Sun, 5 Nov 2017 15:43:46 -0700 Subject: Update remote.py to fix issue #694 --- git/remote.py | 16 ++++++++++++---- 1 file 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 -- cgit v1.2.1 From 7a91cf1217155ef457d92572530503d13b5984fb Mon Sep 17 00:00:00 2001 From: Richard C Gerkin Date: Sun, 5 Nov 2017 16:00:17 -0700 Subject: Further update for machines without ssh installed or on the path --- git/remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/remote.py b/git/remote.py index c5990da1..35460f5a 100644 --- a/git/remote.py +++ b/git/remote.py @@ -542,7 +542,7 @@ class Remote(LazyMixin, Iterable): if ' Push URL:' in line: yield line.split(': ')[-1] except GitCommandError as ex: - if 'correct access rights' in str(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 -- cgit v1.2.1