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

**Code:** `Use SSH over port 443 when port 22 is blocked` · **Category:** Git · **Seen on:** Git

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/git/git-ssh-over-https-port-443-github)
