ssh: connect to host gitlab.com port 22: Network is unreachable

13,666

Solution 1

I would never be able to use SSH URL for any public Git repository hosting service (github.com, gitlab.com, ...) in a work environment.

If the issue persists with other services (ssh -Tv [email protected]), then SSH URLs are not allowed for you. Use an HTTPS URL.

But if on the same network, another server does work, then double-check the firewall rules for your particular machine. One might block SSH, while the other not.
(ufw status verbose)

Solution 2

I've figured it out, the server I've been trying to connect needs a proxy, which solved the problem. But I hope someone can get helped by this.

Solution 3

There are a couple possible reasons for this:

1.) You are on a network which blocks traffic to port 22. Trying your connection from another network or device would be the best way to quickly test for this.

2.) The ssh service on your droplet is not running.

Solutions:

  1. You can change the port that your ssh service listens on in the file /etc/ssh/sshd_conf or you can use other network to test this problem solution.
  2. Configure your SSH key agian.
Share:
13,666
LuisFelipe
Author by

LuisFelipe

Updated on June 04, 2022

Comments

  • LuisFelipe
    LuisFelipe almost 2 years

    I'm trying to reach the Gitlab server to clone a repo in a Ubuntu 20.10 computer, but I always get the message:

    ssh: connect to host gitlab.com port 22: Connection timed out
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    
    

    So, I've tried to run the command ssh -T [email protected], but I've got the message:

    ssh: connect to host gitlab.com port 22: Network is unreachable
    

    I've tried in another computer with Ubuntu 20.04 and it worked.

    Anyone can help me with this?