"Connection refused" error when trying to pull a repo from Gitlab

Error message:

ssh: connect to host gitlab.com port 22: Connection refused
By @mustafa on Sat 08 Sep 2018 |
Tags gitlab ssh git


Offer your help. Be nice!


Not sure if it's my network or GitHub's servers but I couldn't connect on port 22. The solution is to use ssh over https.

Add the following to your ~/.ssh/config

Host github.com
  Hostname ssh.github.com
  PubkeyAuthentication yes
  IdentityFile ~/.ssh/id_rsa
  Port 443
  User git

Replace ~/.ssh/id_rsa with the actual location of your SSH key. If you are not sure, just leave it as is.

Login to leave a response!