ssh: connect to host bitbucket.org 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.
Run Code Online (Sandbox Code Playgroud)
我的防火墙被禁用,我仍然连接超时。我该怎么办?
看起来您对默认 SSH 端口有问题,可以通过使用其他端口来避免这些问题。这是一个常见的问题。
基本上,您可以使用端口 443 而不是 22。
对于Github,答案是:
要在 ssh 配置中进行设置,请编辑 ~/.ssh/config 中的文件,并添加以下部分:
Run Code Online (Sandbox Code Playgroud)Host github.com Hostname ssh.github.com Port 443
BitBucket于 2011 年 6 月 15 日停止在端口 443 上使用 SSH,但我认为(请仔细检查)您可以告诉您的服务器管理员通过不同的端口设置 SSH 以防止超时(请参阅下面的来源链接)
对于Gitlab,ssh 配置如下所示。更新 IdentityFile 以匹配您的本地私钥:
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab
Run Code Online (Sandbox Code Playgroud)资料来源:
https://about.gitlab.com/2016/02/18/gitlab-dot-com-now-supports-an-alternate-git-plus-ssh-port/
https://help.github.com/en/articles/using-ssh-over-the-https-port