解决Github拉取仓库缓慢无网络等问题

当您在使用Github拉取仓库时遇到缓慢或无网络等问题时,可以尝试以下几种方法来解决该问题。首先,您可以尝试检查您的网络连接,确保您的计算机可以正常连接到互联网。其次,您可以尝试清除浏览器缓存或切换到其他浏览器来拉取仓库。如果您使用的是Git客户端,您可以尝试使用SSH协议来进行仓库拉取。此外,您可以尝试修改您的Git全局配置,调整HTTP缓冲区大小等设置来提高拉取速度。

有几种方法可以尝试解决 Github 拉取仓库慢的问题:

更换网络

尝试连接不同的网络,比如切换到使用手机热点的方式连接互联网。

使用代理

可以尝试使用代理服务器,正规企业可以申请对外通道。

修改 hosts

修改本地 hosts 文件,加入 Github 的 IP 地址,避免 DNS 解析的慢速问题。

打开全球ping等网站全球ping github.com

image-20230213224207032

最后修改hosts文件 把对于关系加入重启网络即可,如:

140.82.112.3    github.com

切换镜像

可以尝试使用国内的镜像站点,比如使用码云、阿里云等国内的 Git 仓库。

可以利用国内码云拉取Github仓库,就是克隆Github上的仓库到码云上

image-20230213224523720

image-20230213224643821

填入对因的仓库克隆后就可以用gitee的连接克隆仓库了。

优化 Git 配置

可以尝试通过修改 Git 的配置来优化下载速度,比如设置 Git 缓存、减少 Git 对文件的扫描等。

首先你需要一个代理服务器我这里代理服务器端口是7890

开启本地git代理

git config --local user.name Rakers1024

git config --local http.proxy http://127.0.0.1:7890

git config --local https.proxy http://127.0.0.1:7890

开启全局git代理

git config --global user.name Rakers1024

git config --global http.proxy http://127.0.0.1:7890

git config --global https.proxy http://127.0.0.1:7890

关闭代理

git config --local --unset http.proxy

git config --local --unset https.proxy

git config --global --unset http.proxy

git config --global --unset https.proxy


查看git配置

git config --list

使用命令行克隆仓库同时代理(推荐)

git clone https://github.com/user/repository.git --config http.proxy=http://127.0.0.1:7890 --config https.proxy=http://127.0.0.1:7890
© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容