Bitbucket Cloud complains "Network is down" and cannot operate commands via ssh

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.


Problem

When you try to operate git/mercurial commands (such as git-clone, git-pull, git-fetch or git-push, etc), Bitbucket responses the error like below even if the repository exists and doesn't have any problem in access rights:

$ git clone git@bitbucket.org:<username>/<repository_name>.git
Cloning into '<repository_name>'...
ssh: connect to host bitbucket.org port 22: Network is down
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


Diagnosis

Diagnostic Steps

Perform the SSH command below:

ssh -vvvT git@bitbucket.org


The expected output includes 2 messages below:

  • the debug message mentioning "IP_TOS" like as below:

    [203.0.113.0]:22 (debug3: ssh_packet_set_tos: set IP_TOS 0x08)
  • the message telling you could successfully log in:

    logged in as <username>.


Otherwise, you can determine the ssh connection may use unsupported protocol, specifically, IPv6. For example, the unexpected output looks like below:

debug1: Reading configuration data /Users/<username>/.ssh/config
debug1: /Users/<username>/.ssh/config line 241: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to bitbucket.org port 22.
ssh: connect to host bitbucket.org port 22: Network is down


Cause

You may have an issue connecting with IPV6.  Here are the commands to test.  This is the expected output if IPv6 is not working:

ssh -6Tv git@bitbucket.org
...
ssh: connect to host bitbucket.org port 22: Network is down

This command forces IPv4.  

$ ssh -4T git@bitbucket.org
logged in as <username>.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

If IPv4 works please continue to the workarounds.  If IPv4 does not work, the problem described here is not your issue.

Workaround

Define ssh command

Temporarily define the ssh command.

GIT_SSH_COMMAND="ssh -4" git clone git@bitbucket.org:<username>/<repository_name>.git


Edit .ssh config

Edit SSHD configuration file (such as ~/.ssh/config) to enforce IPv4 connection:

~/.ssh/config
Host bitbucket.org
  AddressFamily inet


Resolution

IPv6 seems to not be configured correctly on your network.  Please advise your network admin of this issue.




Last modified on Sep 21, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.