Open
Description
Hi,
I'm hitting the below line in git/remote.py:
Seemingly because my git(-lab) server has an SSH banner like this:
$ ssh login
_ _ _ _ _ ___ _
__| | | _____ __| | ___ _ __ __ _ _ __ ___(_) __| |/ _ \/ |
/ _` | |/ / __/ _` |/ __| '__/ _` | '_ \ / __| |/ _` | | | | |
| (_| | < (_| (_| | (__| | | (_| | | | | (__| | (_| | |_| | |
\__,_|_|\_\___\__,_|\___|_| \__,_|_| |_|\___|_|\__,_|\___/|_|
user@dkcdcrancid01.corp.com's password:
From what I can tell, then the issue is (also in remote.py) in class Remote._get_fetch_info_from_stderr():
for line in progress.other_lines:
line = force_text(line)
for cmd in cmds:
if len(line) > 1 and line[0] == ' ' and line[1] == cmd:
fetch_info_lines.append(line)
continue
where cmd contains ' ' (single whitespace), which will match the very first line, which is clearly not git output.
I know the easy fix is to remove the SSH banner, but it should be relatively easy to improve the matching on valid cmd lines I'd expect?
In my own env, I did a quick fix like so:
for line in progress.other_lines:
line = force_text(line)
if re.match(r'^[a-z^A-Z]+$', line): # added
continue # added
for cmd in cmds:
if len(line) > 1 and line[0] == ' ' and line[1] == cmd:
fetch_info_lines.append(line)
continue
Probably there are better ways of fixing this?