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
- Configure Port 443 via ssh.github.com
- Test the connection
- Use HTTPS remotes as an alternative
Detailed fix by platform
Shell
- bash
printf "Host github.com HostName ssh.github.com Port 443 User git " >> ~/.ssh/config ssh -T git@github.com
How to diagnose
- Port 22 — blocked?
- 443 — open?
- 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:
Similar errors
- Bad configuration option: usekeychain ssh: /Users/me/.ssh/config: line 5: Bad configuration option: usekeychain
- 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
- client_loop: send disconnect: Broken pipe client_loop: send disconnect: Broken pipe (SSH session drops when idle)
Most viewed in Git
- Git SSL certificate problem fatal: unable to access 'https://…': SSL certificate problem: unable to get local issuer certificate
- gpg failed to sign error: gpg failed to sign the data — fatal: failed to write commit object
- workflow scope ! [remote rejected] … (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/x.yml` without `workflow` scope)
Other ways to find it
Where this error sits
Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 25 Nov 2026