无法连接到 bitbucket.org 端口 443:网络无法访问

Failed to connect to bitbucket.org port 443: Network is unreachable

我在推送代码时遇到问题。

git push origin master

fatal: unable to access 'https://xxxxxxxxxx@bitbucket.org/xxxxxx/xxxxxx.git/': 
Failed to connect to bitbucket.org port 443: Network is unreachable

如何避免该错误消息?

TLDR;先试试git push -4 origin master


有问题报告当前通过 https 访问 bitbucket 的问题 (issue 13060, issue 12184)

通常的答案是:

"Failed to connect" errors could be anything from DNS issues to local network problems to ISPs that are incompletely routing Bitbucket traffic. Unfortunately, there isn't enough detail in any of these comments to diagnose the exact problems, which may or may not be related to each other. If you could, please open a support ticket with the results of the following commands:

For OS X, Linux, and other UNIX-based operating systems:

ping -c10 bitbucket.org
ping6 -c10 bitbucket.org
traceroute bitbucket.org
traceroute6 bitbucket.org
GIT_CURL_VERBOSE=1 git ls-remote https://bitbucket.org/bitbucket/do_not_delete

For Windows:

ping -n 10 bitbucket.org
ping -n 10 -6 bitbucket.org
tracert bitbucket.org
tracert -6 bitbucket.org

(To clarify: "ping6" and "traceroute6" are the IPv6 equivalents of "ping" and "traceroute", respectively, and "GIT_CURL_VERBOSE=1" before any git command will detail all the HTTP-specific parts of the connection.
On the Windows side of things, the "-6" in the command line specifies that your computer should use IPv6 for the ping or tracert.)

Additionally, if you suspect that your problem is related to Bitbucket's IPv6 support, then you should be able to test your overall IPv6 connectivity by opening the following links in your browser:

https://ipv6.google.com
https://www.v6.facebook.com

Those links should not work at all if your IPv6 connection is disabled or misconfigured.


更一般地说,检查您的 /etc/hosts 是否有任何关于 bitbucket.org 的条目。
参见“What are the Bitbucket Cloud IP addresses I should use to configure my corporate firewall?

最近更改了 IP 地址:

Since July 28, 2018: IPv4 inbound for bitbucket.org, api.bitbucket.org, and altssh.bitbucket.org

18.205.93.0/25
18.234.32.128/25
13.52.5.0/25

记住ping might be blocked,触发同样的错误信息。


IPV6 可能有问题:同一线程建议:

This is probably coming when git is trying to push over IPV6. I'm not exactly sure why getting this error with IPV6. But here are different solutions, that you can use to fix this problem.

Add any one of the following IP into /etc/hosts file to force git to use IPV4

104.192.143.2
104.192.143.3
104.192.143.1

That is,

104.192.143.2 bitbucket.org

To /etc/hosts file

(Or)

Upgrade your git to latest version. Probably this could solve the problem else use the following option when you push after you upgrade git (this feature was added newly to git)

 -4, --ipv4 use IPv4 addresses only

That is ,

git push -4 bitbucket dev

You can specify this option -4 while you push, pull or clone.

(Or)

You may configure git to use http proxy to solve this problem

 git config --local http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

If you are already using latest version of git, you can simply use option -4 to force git to use IPV4 address or you can go with /etc/hosts

If you wanna see debug message while pushing or pulling code you can set following environment variable before you do so,

export GIT_CURL_VERBOSE=1

我关注了 this page 上的讨论并将这一行添加到我的主机文件中:

104.192.143.2 bitbucket.org

有效。我的系统是unbuntu,所以host文件在/etc/hosts,你需要有root权限。

只需在您的 ~/.ssh/config 中添加一个条目,如下所示:

Host bitbucket.org
  AddressFamily inet

检查防火墙设置。这就是我的问题。

如果您仍然收到此错误并且上述方法不起作用,则可能是防火墙问题;这意味着某些东西故意阻止了连接,而不是 "failure"。尝试仔细检查您的防火墙,并按照标准步骤进行网络故障排除。

根据我所做的基本 google 搜索,导致此错误的三个主要原因是代理设置无效、IPv6 地址处理不当或客户端出现一般网络错误。

我解决了这个问题。 发生这种情况的原因之一是您的系统位于代理网络上。 在这种情况下,您必须 运行 下面的命令:

$ git 配置 --global http.proxy http://username:password@proxy:port

其中,用户名:您的系统用户 ID| 密码:系统密码| 代理:您正在使用的代理的 IP 地址 | 端口 : 该代理的|

这是由于我的组织网络的网络限制导致的。

刷新 dns 缓存对我有用(Ubuntu、18.04):

sudo systemd-resolve --flush-caches

我们可以通过在推送提交到 repo 之前在命令提示符中设置代理来解决。

set HTTP_PROXY=http://user:pass@your_proxy: port

只需通过命令提示符添加您的代理设置即可:

设置 HTTPS_PROXY=http://user:pass@yourProxy:8080

这太疯狂了,从 /etc/hosts 中删除 104.192.143.2 bitbucket.org 后它开始为我工作

我已从此路径 /etc/hosts 中删除 104.192.143.2 bitbucket.org。它开始工作了。

编辑: 我再次遇到 Failed to connect to bitbucket.org port 443: Network is unreachable.

的错误

我添加了新的 ip 18.205.93.0 bitbucket.org,它运行良好。您只需输入此命令即可找到 ip ping -c10 bitbucket.org.

参考:For more information visit this link

所以我遇到了同样的问题,既无法在浏览器中加载 bitbucket,也无法从终端推拉克隆 bitbucket 我跟着讨论。 我的主机文件中有 104.192.143.3 bitbucket.org 这是我第一次为另一个项目使用 bit bucket 时添加的。

所以想到从主机文件中删除它,它又开始工作了 它有点奇怪的社区必须想出这个的原因

我遇到了这个问题,甚至用官方 IP 地址 https://confluence.atlassian.com/bitbucket/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall-343343385.html

中的 IP 地址更改 /etc/hosts

服务器没有通过使用像 104.192.143.1 这样的 ip4 从 bitbucket 克隆任何项目,只是速度很慢而且没有响应

对我来说已解决 enable/add ip6 in /etc/network/interfaces。大声笑,对于每个虚拟化个人,但对于 kvm 看起来像

iface ens3 inet6 static
        address 2a04:5200:fff5::89e
        netmask 48
        gateway 2a04:5200:fff5::1
        up ip -6 addr add 2a04:5200:fff5::8ea dev ens3
        down ip -6 addr del 2a04:5200:fff5::8ea dev ens3

OpenVZ 看起来像

iface venet0 inet6 manual
    up ifconfig venet0 add 2a04:5200:fff7::bb6/128
    down ifconfig venet0 del 2a04:5200:fff7::bb6/128
    up route -A inet6 add default dev venet0
    down route -A inet6 del default dev venet0

尝试激活或在您的面板主机中添加 ip6 ip 地址并重新安装,但删除那里的所有文件。

这对我有用。 我运行下面这个命令

ping -n 10 bitbucket.org

然后从 visual studio 团队资源管理器同步。然后就成功了

切换网络提供商。 有时您的网络提供商会导致此类问题。

对于windows 打开命令提示符并执行:

  1. ping -n 10 bitbucket.org
  2. tracert bitbucket.org

这个肯定没问题了。它适用于我的。

建议1:把你的原点去掉,重新设置原点,再试试push/pull。希望它能奏效。

 git remote -v
 git remote remove origin
 git remote add origin https://habibus@bitbucket.org/softbd/oss-project.git 

建议 2: 如果其中任何一行可用,请从 Windows/System32/drivers/etc/hosts 中删除这些行。

 104.192.143.1 bitbucket.org
 104.192.143.2 bitbucket.org
 18.205.93.0 bitbucket.org

建议三:更换网络connection/provider。有时您的网络提供商会导致此类问题。

建议 4:检查防火墙设置。有时是显示这种错误的问题。

建议5:检查你的git版本,然后运行以下命令升级。

 sudo add-apt-repository ppa:git-core/ppa
 sudo apt-get update
 sudo apt-get install git