Skip to content

Fixes issue #694 #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions git/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,18 @@ def urls(self):
# 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

Expand Down