如何解决22端口连接超时问题

2024-04-28

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。

  • For Github, 答案是:

要在 ssh 配置中进行设置,请编辑 ~/.ssh/config 中的文件,然后 添加此部分:

Host github.com
    Hostname ssh.github.com
    Port 443
  • 比特桶:下面的答案确认您仍然可以执行此操作,即使它本应于 2011 年 6 月 15 日停止:

     Host bitbucket.org
      Hostname  altssh.bitbucket.org
      Port  443
    
  • For Gitlab,ssh 配置如下所示。更新 IdentityFile 以匹配您的本地私钥:

     Host gitlab.com
         Hostname altssh.gitlab.com
         User git
         Port 443
         PreferredAuthentications publickey
         IdentityFile ~/.ssh/gitlab
    

Sources:

  • https://about.gitlab.com/2016/02/18/gitlab-dot-com-now-supports-an-alternate-git-plus-ssh-port/ 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 https://help.github.com/en/articles/using-ssh-over-the-https-port

  • https://confluence.atlassian.com/bitbucketserver/enabling-ssh-access-to-git-repositories-in-bitbucket-server-776640358.html https://confluence.atlassian.com/bitbucketserver/enabling-ssh-access-to-git-repositories-in-bitbucket-server-776640358.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何解决22端口连接超时问题 的相关文章

随机推荐