Error messages
ssh: connect to host port 22: Operation timed out on Mac
ssh sent a connection request to port 22 and got no answer. On a Mac, the system error text is “Operation timed out”. Linux says “Connection timed out”.
Symptoms
- Terminal shows
ssh: connect to host github.com port 22: Operation timed out. - Git then shows
fatal: Could not read from remote repository. - SSH works on another network, such as your home network.
Likely causes
- The network blocks port 22. Company, school, hotel and public networks often block SSH. GitHub says that firewalls sometimes refuse SSH connections.
- A broken IPv6 path. The Mac tries IPv6 first, and IPv6 does not work.
- A VPN or proxy. Traffic goes through a VPN that does not pass SSH.
- The server is down or filtered. The server does not answer on port 22.
How to check
Test the TCP port alone, with a 5-second timeout.
nc -vz -G 5 github.com 22Try IPv4 only.
ssh -4 -T git@github.comFor GitHub, test SSH on port 443.
ssh -T -p 443 git@ssh.github.comConnect with details. The last lines show where it stops.
ssh -vT git@github.com
How to fix it
If port 443 works, use it for GitHub. Add this block to
~/.ssh/config.Host github.com Hostname ssh.github.com Port 443 User gitIf only IPv4 works, add
AddressFamily inetto the host's block in~/.ssh/config.Use the HTTPS URL of the repository instead, as a test.
For your own server, ask the network administrator to allow its SSH port.
With Kilobat
Kilobat's connection doctor tests the host layer by layer: network, proxy, DNS, rules, IPv4, IPv6, TLS and the server. It names the layer that failed.
kilobat why github.comThese Kilobat checks are free. AI agents run them through MCP with
diagnose_connectionanddiagnose_network. See Find why one site or API won't connect.
Questions
Why does my Mac say Operation timed out, not Connection timed out?
ssh prints the system's text for the error. On macOS, the text for ETIMEDOUT is “Operation timed out”.
Sources
- GitHub Docs: Using SSH over the HTTPS port
- ssh(1), ssh_config(5) and nc(1), man page installed with macOS 27.2
- intro(2), ETIMEDOUT, man page installed with macOS 27.2
Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.