Git over SSH occasionally hangs behind a VPN (e.g., Bitbucket). No error, just a long pause before it connects, or a timeout. Forcing IPv4 fixes it:
GIT_SSH_COMMAND='ssh -4' git fetch originGIT_SSH_COMMAND overrides the ssh binary git shells out to, flags included. Same mechanism works for pointing one repo at a specific key or config file, without touching global ~/.ssh/config.
The working theory, unconfirmed: some VPN clients (e.g., WireGuard-based) don’t always handle IPv6 the same way as IPv4, sometimes for privacy reasons (leak protection), sometimes by config gap. If the interface still reports an IPv6 address while that path is actually a dead end, SSH could be trying IPv6 first and only falling back to IPv4 after a timeout, which would explain the hang rather than a clean failure.