diff --git a/docs/kittens/ssh.rst b/docs/kittens/ssh.rst index bdbe4a2d0..bbeb45bb6 100644 --- a/docs/kittens/ssh.rst +++ b/docs/kittens/ssh.rst @@ -61,7 +61,7 @@ Additionally, you can pass config options on the command line: The :code:`--kitten` argument can be specified multiple times, with directives from :file:`ssh.conf`. These are merged with :file:`ssh.conf` as if they were appended to the end of that file. They apply only to the host being SSHed to -by this invocation. +by this invocation, so any :opt:`hostname` directives are ignored. .. note:: diff --git a/kittens/ssh/main.py b/kittens/ssh/main.py index cda28890b..b261947b0 100644 --- a/kittens/ssh/main.py +++ b/kittens/ssh/main.py @@ -552,7 +552,9 @@ def run_ssh(ssh_args: List[str], server_args: List[str], found_extra_args: Tuple pat = re.compile(r'^([a-zA-Z0-9_]+)[ \t]*=') for i, a in enumerate(found_extra_args): if i % 2 == 1: - overrides.append(pat.sub(r'\1 ', a.lstrip())) + aq = pat.sub(r'\1 ', a.lstrip()) + if aq.split(maxsplit=1)[0] != 'hostname': + overrides.append(aq) if overrides: overrides.insert(0, f'hostname {uname}@{hostname_for_match}') so = init_config(overrides)