700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > git push失败:ssh:connect to host github.com port 22:Connection timed out

git push失败:ssh:connect to host github.com port 22:Connection timed out

时间:2024-01-19 16:08:19

相关推荐

git push失败:ssh:connect to host github.com port 22:Connection timed out

问题描述:ssh:connect to host port 22:Connection timed out

问题原因:可能是网络下修改防火墙的问题,导致阻塞了一些端口

解决方案:

步骤1:

ssh -T git@

作用是验证当前的SSH key是不是正常工作

Hi xxx! You've successfully authenticated, but GitHub does not # provide shell access.

看到上述内容,表示当前的SSH key是正常工作的,若不是正常工作,则需要重新生成并添加SSH key

步骤2:若上述操作成功,则用HTTP协议代替SSH,需要将配置文件中的URL改为HTTP

git config --local -e

在git中输入上述代码,修改:

url = git@:username/repo.git

为:

url = /username/repo.git

这样就能push了,不会timeout了。该方法同样适用于gitlab。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。