Port 22 is blocked on local network
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
Some network administrators block outgoing SSH connections on port 22. If your network blocks this port, Bitbucket provides an alternate hostname and port combination you can use.
This article describes how to use the alternate ssh host: altssh.bitbucket.org:443.
Environment
Any network where outgoing port 22 is not allowed.
Diagnosis
When attempting to clone a repository, the following ssh error is presented.
Cloning into '...'...
ssh: connect to host bitbucket.org port 22: Connection timed out
fatal: Could not read from remote repository.
To test if you can make tcp connections to bitbucket.org, you can run a telnet command to test if IP and TCP can connect. This is an example of a successful telnet test to bitbucket.org using port 22.
$ telnet bitbucket.org 22
Trying 18.205.93.0...
Connected to bitbucket.org.
Escape character is '^]'.
SSH-2.0-conker_a0c557575e cb18a499538d
Connection closed by foreign host.
$
This error means that your client was not able to establish a tcp connection to bitbucket.org.
Running telnet on port 22
Trying 18.205.93.0...
telnet: Unable to connect to remote host: Connection timed out
Cause
A firewall rule is blocking outgoing connections over port 22.
Solution
Instead of using the normal ssh port, use altssh.bitbucket.org over port 443. Typically, port 443 is used for HTTPS, so administrators leave this port open for outbound web browsing. In this case, here's the URLs you can use:
ssh://git@altssh.bitbucket.org:443/<Workspace>/<repo_name>/
Here is a normal clone command and alternate command as an example:
git clone git@bitbucket.org:<Workspace>/<repo_name>/ # Original
git clone ssh://git@altssh.bitbucket.org:443/<Workspace>/<repo_name>/ # Alternate