ohmyzsh: ssh completion broken in last version (takes always an entry in /etc/hosts if present)

Since a few days (last update) my oh-my-zsh fails when typing the beginning of a Hostname value in .config/ssh. For example, in my .ssh/config I have:

Host home-dev-1
    hostname    X.X.X.X
    user              xxxxx

and in my /etc/hosts I have:

1.2.3.4   home-test

If I type in the terminal ssh home and press TAB then I get home-test (which is an entry in my /etc/hosts).

If there is no entries in my /etc/hosts beginning with “home” then it would get entries in my .ssh/config. But obviously this is not the expected behavior and it is a clear regression.

About this issue

  • Original URL
  • State: open
  • Created 10 years ago
  • Reactions: 4
  • Comments: 16 (7 by maintainers)

Most upvoted comments

It’s now 2019, this is still a problem.

A somewhat related issue - I also experience a ghost hosts file problem (not sure if that’s been reported):

On my Macbook I once had a hosts file entry for someserver.dev (name adjusted for privacy), while on my newer iMac (some various dot files copied over from my Macbook) that entry does not exist in the hosts file, not even as a commented out line; but still when I type some and press tab, it’ll immediately complete someserver.dev regardless of how many other servers I have starting with some in .ssh/config.

I’ve tried to remove any instances of someserver.dev from my zsh history file, but still no luck.

To workaround the “ghost hosts file” problem, I’ve ended up having to just add additional aliases for those servers that don’t start with some, but still my old habits are hard to break, and at least once every few days I’ll run into this completion problem.

For host entries that first existed on my iMac, simply commenting them out, and then opening a new terminal session is enough to restore my tab completion, but not exactly a “solution”…

Is there any real solution for this? This issue has been open for almost 5 years now, and there’s not so much as a workaround.