summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard C Gerkin <rick1@gerkin.org>2017-11-05 15:43:46 -0700
committerGitHub <noreply@github.com>2017-11-05 15:43:46 -0700
commitecd061b2e296a4f48fc9f545ece11c22156749e1 (patch)
tree5b3bd743dcf94934065a6a06006d9d91802353c1
parentbfae362363b28be9b86250eb7f6a32dac363c993 (diff)
downloadgitpython-ecd061b2e296a4f48fc9f545ece11c22156749e1.tar.gz
Update remote.py to fix issue #694
-rw-r--r--git/remote.py16
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