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.
我的防火墙已被禁用,但我仍然无法连接。我该怎么做?
看起来您有默认SSH端口的问题,可以通过使用其他端口来避免这些问题。这是一个常见的问题。
基本上,您可以使用443端口代替22端口。
To set this in your ssh config, edit the file at ~/.ssh/config, and add this section:
Host github.com Hostname ssh.github.com Port 443
BitBucket: Answers below confirmed you can still do this even though it was supposed to be discontinued on June 15, 2011:
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
For Gitlab, the ssh config looks like this. Update the IdentityFile to match your local private key:
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab
Sources:
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
回答有些晚,但我的配置文件适用于GitHub和BitBucket
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
Host github.com
Hostname ssh.github.com
Port 443
GIT_SSH_COMMAND="ssh -v" git clone example
你甚至可以使用以下命令增加详细程度:GIT_SSH_COMMAND="ssh -vvv" git clone example
- ErniBrown