summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2017-11-19 15:59:23 +0100
committerGitHub <noreply@github.com>2017-11-19 15:59:23 +0100
commit28cbb953ce01b4eea7f096c28f84da1fbab26694 (patch)
tree5d4d9ca1e51619f528e609e5c724480b72c48762
parentd91ae75401b851b71fcc6f4dcf7eb29ed2a63369 (diff)
parent7a91cf1217155ef457d92572530503d13b5984fb (diff)
downloadgitpython-28cbb953ce01b4eea7f096c28f84da1fbab26694.tar.gz
Merge pull request #695 from rgerkin/issue694
Fixes 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..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