ssh connect to host github.com port 22 Connection refused

前提

  1. 首選確認Deploy Key添加正確
  2. 確認倉庫設定沒有問題

報錯訊息

➜  ~ git clone git@github.com:euiuu/life-blog.git
正在克隆到 'life-blog'...
ssh: connect to host github.com port 22: Connection refused
fatal: 無法讀取遠程倉庫。

請確認您有正確的訪問權限並且倉庫存在。

解決方法

According to this

Sometimes, firewalls refuse to allow SSH connections entirely. If using HTTPS cloning with credential caching is not an option, you can attempt to clone using an SSH connection made over the HTTPS port. Most firewall rules should allow this, but proxy servers may interfere

➜  ~ nano ~/.ssh/config
Host github.com
 Hostname ssh.github.com
 Port 443
➜  ~ ssh -T git@github.com
Hi Gost ! You've successfully authenticated, but GitHub does not provide shell access.