Fix GitHub SSH Hang: Port 443, HTTPS, and Proxy Configuration Guide
Contents
Fix GitHub SSH Hang: Port 443, HTTPS, and Proxy Configuration Guide
If ssh -T [email protected]
never returns, your network to GitHub’s SSH port (22) is likely blocked or unstable. This is common in certain regions, corporate/campus environments, or some cloud servers.
Solutions
1. Use HTTPS Instead (Recommended)
- Use the repository’s HTTPS URL for clone/pull/push; it’s typically more stable.
- Use a Personal Access Token (PAT) as the password when prompted.
2. Force SSH via Port 443
Sometimes port 22 is blocked but 443 is open. Route SSH via 443 by adding to ~/.ssh/config
:
Host github.com
HostName ssh.github.com
User git
Port 443
Then test:
ssh -T [email protected]
3. Check Connectivity
- Try
ping github.com
ortelnet github.com 22
/telnet ssh.github.com 443
. - Switch networks (mobile hotspot/broadband) or try VPN/proxy.
4. Use a Proxy (If Available)
If you have an HTTP/SOCKS5 proxy, make SSH use it.
Temporary env var way:
export ALL_PROXY=socks5://127.0.0.1:1080
ssh -T [email protected]
Or via ProxyCommand in ~/.ssh/config
:
Host github.com
HostName ssh.github.com
User git
Port 443
ProxyCommand nc -x 127.0.0.1:1080 %h %p
Additional Tips
- Check local firewalls and cloud security groups to ensure outbound 22/443 isn’t blocked.
- In corporate/campus networks, contact the network admin or use a compliant VPN.
- If SSH remains unstable over time, prefer HTTPS + PAT to avoid SSH port issues.