Software⏱️ 2 min read📅 2026-06-03

How to Fix: How to fix "ssh: connect to host github.com port 22: Connection timed out" for git push/pull/... commands

Git connection timeout error under proxy.

Quick Answer: Check your proxy settings and ensure they are not interfering with the SSH connection. Try setting the "ProxyPass" and "ProxyName" variables in your shell configuration file (e.g., ~/.ssh/config) to bypass the proxy for git commands.

If you are experiencing issues with SSH connectivity due to a proxy, it's possible that your configuration is not set up correctly. Git relies on the SSH protocol to communicate with GitHub, and a timeout can occur if there's an issue with the connection.

⚠️ Common Causes

  • Insufficient proxy settings or incorrect proxy configuration

🚀 How to Resolve This Issue

Method 1: Verify Proxy Configuration

  1. Step 1: Check your Git configuration to ensure the proxy settings are correct. Run `git config --get all` and verify that the 'http.proxy' and 'https.proxy' settings match your proxy server's URL.

Method 2: Use SSH Tunneling

  1. Step 1: Set up an SSH tunnel using the `-D` option. Run `ssh -D 1080 user@proxy-server.com` to create a local port forwarding, and then run your git command with `--http-proxy` option set to `http://localhost:1080`. For example, `git push --http-proxy http://localhost:1080 origin master

🎯 Final Words

By following these steps and verifying your proxy configuration, you should be able to resolve the SSH connection timeout issue and successfully push/pull from GitHub.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions