From b6cfa0c03f5c32699122acfca7b1708223480b6e Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Fri, 22 Apr 2016 11:30:08 +0300 Subject: [PATCH] main: show better error when no SSH remote is found --- trezor_agent/__main__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/trezor_agent/__main__.py b/trezor_agent/__main__.py index bebb043..54f935c 100644 --- a/trezor_agent/__main__.py +++ b/trezor_agent/__main__.py @@ -98,9 +98,9 @@ def git_host(remote_name, attributes): continue url = matches[0].strip() - user, url = url.split('@', 1) - host, _ = url.split(':', 1) # skip unused path (1 key per user@host) - return '{}@{}'.format(user, host) + match = re.match('(?P.*?)@(?P.*?):(?P.*)', url) + if match: + return '{user}@{host}'.format(**match.groupdict()) def ssh_sign(conn, label, blob): @@ -159,7 +159,8 @@ def run_git(client_factory=client.Client): with client_factory(curve=args.ecdsa_curve_name) as conn: label = git_host(args.remote, ['pushurl', 'url']) if not label: - log.error('Could not find "%s" remote in .git/config', args.remote) + log.error('Could not find "%s" SSH remote in .git/config', + args.remote) return public_key = conn.get_public_key(label=label)