Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SSHing github花费的时间太长_Git_Github_Ssh - Fatal编程技术网

SSHing github花费的时间太长

SSHing github花费的时间太长,git,github,ssh,Git,Github,Ssh,一旦我跑了 ssh -T git@github.com 我确实得到了输出 Hi V4G4X! You've successfully authenticated, but GitHub does not provide shell access. 不幸的是,我不得不等待2分12秒。 这可能是什么原因造成的?这取决于您的环境、操作系统和Git版本 例如,在: SSH支持IPv4和IPv6,如果DNS检索AAAA记录,则首选IPv6,但我的ISP不支持IPv6,这会导致巨大的延迟 我们可以用两种

一旦我跑了

ssh -T git@github.com
我确实得到了输出

Hi V4G4X! You've successfully authenticated, but GitHub does not provide shell access.
不幸的是,我不得不等待2分12秒。

这可能是什么原因造成的?

这取决于您的环境、操作系统和Git版本

例如,在:

SSH支持IPv4和IPv6,如果DNS检索AAAA记录,则首选IPv6,但我的ISP不支持IPv6,这会导致巨大的延迟

我们可以用两种方法来解决这个问题

  • 过滤掉AAAA回复,这样我们就只剩下IPv4地址了(工作量太大)
  • /etc/ssh/ssh\u config
    中设置“
    AddressFamily inet
    ”以强制IPv4连接
更改ssh\u config后,请重新启动ssh客户端,在Ubuntu上,命令为

sudo service ssh restart"

为什么要优先处理不需要的流量以快速运行?@tripleee但当时没有任何其他应用程序可以使用网络。服务器不想花时间为不允许的请求提供服务。我怀疑这个问题是由于github服务器的负载。强制IPv4连接暂时“修复”了这个问题。但这以后肯定会产生另一个问题。我看到了
AddressFamily inet
步骤。但据我所知,我现在只能使用IPv4连接,而不能使用IPv6连接,对吗?这不会引起问题吗?同样,这取决于你的环境,而我对你的环境一无所知。但要测试一下,以防万一。