Use SSH over port 443 when port 22 is blocked Git Origin: Build & delivery OSI layer 7 · Application Last updated 25 Nov 2026

ssh: connect to host github.com port 22: Connection refused

Port 22 is blocked, but GitHub offers SSH on 443.

Exact message you may see ssh: connect to host github.com port 22: Connection refusedSSH over port 443 githubssh.github.com port 443
Seen on: Git

Meaning

Add to ~/.ssh/config: Host github.com HostName ssh.github.com Port 443 User git. Test with ssh -T -p 443 git@ssh.github.com.

Common causes

  • Firewall blocks 22
  • Corporate network
  • Hotel/public Wi-Fi

⚡ Quick fix

  1. Configure Port 443 via ssh.github.com
  2. Test the connection
  3. Use HTTPS remotes as an alternative

Detailed fix by platform

Shell

  1. bash
    printf "Host github.com
      HostName ssh.github.com
      Port 443
      User git
    " >> ~/.ssh/config
    ssh -T git@github.com

How to diagnose

  1. Port 22 — blocked?
  2. 443 — open?
  3. Config — added?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):

Bad configuration option: usekeychain — ssh: /Users/me/.ssh/config: line 5: Bad configuration option: usekeychain (macOS)Bad configuration opt…batch response: This repository is over its data quota — batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs (Git)batch response: This …client_loop: send disconnect: Broken pipe — client_loop: send disconnect: Broken pipe (SSH session drops when idle) (Linux)client_loop: send dis…Commit shows Unverified on GitHub — (behavior) Unverified badge: the email in this signature doesn't match the committer (Git)Commit shows Unverifi…Connection closed by remote host / Connection reset by peer on git push — Connection closed by 140.82.112.4 port 22 (Git)Connection closed by …Connection reset: kex_exchange_identification: banner line contains invalid characters — kex_exchange_identification: banner line contains invalid characters (Git)Connection reset: kex…Connection timed out (firewall blocking port) / ufw status — curl: (28) Connection timed out after 10001 milliseconds (Linux)Connection timed out …ERROR: The key you are authenticating with has been marked as read only — ERROR: The key you are authenticating with has been marked as read only. fatal: Could not read from remote repository. (Git)ERROR: The key you ar…Use SSH o…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.