Github访问超时解决办法

2024年1月23日 Jerry 490 2024年1月23日

github上传代码老是超时失败,提示timeout,网上搜了搜解决办法,挨个试了试,做个笔记,省的后面又找半天。

方法1:github ssh转为http

附上方法:

# 进入项目目录查看当前模式:
$ git remote -v

#SSH切换HTTP:
git remote set-url origin https://github.com/xxxx/PLAN.git

#HTTP切换SSH:
$ git remote set-url origin git@github.com:xxxx/PLAN.git

有时候ssh切换为http还是没有解决问题,那么试试方法2

方法2:以linux为例

修改 /etc/hosts 添加如下内容

140.82.113.3 github.com
199.232.69.194 github.global.ssl.fastly.net
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com

Windows操作系统中的hosts文件位于以下路径: C:\Windows\System32\drivers\etc\hosts

试试有没有解决!


原创文章,转载请注明出处: https://jerrycoding.com/article/github-timeout

微信
jerry微信赞助
支付宝
jerry支付宝赞助

您尚未登录,暂时无法评论。请先 登录 或者 注册

0 人参与 | 0 条评论