August 8, 2026
Stop Terminal from tab-completing remote URLs with URLs from /etc/hosts
I have a metric bajillion URLs in my hosts file thanks to https://github.com/StevenBlack/hosts and I found sometimes when I ask the CLI to tab-complete a command like
git push ori
git or the CLI will go look through the hosts file to come back with thousands of suggestions which are always wrong. Here’s how I stop that and get just the remotes that are actually registered with the git repo
MacOS
add to ~/.zshrc
zstyle ':completion:*:hosts' hosts 'reply=()'