CentOS 服务器 git clone下载加速(下载过慢或超时)

简介: CentOS 服务器 git clone下载加速(下载过慢或超时)

  • CentOS 服务器 上通过 git clone 下载项目,速度很慢或直接超时
[root@VM-0-11-centos home]# git clone https://github.com/dengzemiao/DZMLuckyDraw.git
正克隆到 'DZMLuckyDraw'...
error: RPC failed; result=35, HTTP code = 0
fatal: The remote end hung up unexpectedly
  • git clone 特别慢,是因为 github.global.ssl.fastly.net 域名被限制了,只要找到这个域名对应的 IP 地址,然后在 hosts 文件中加上 ip–>域名 的映射,刷新 DNS 缓存便可。
  • nslookup 命令获取 githubIP 地址
    1、如果没有安装,则需要安装一下
$ yum -y install bind-utils
  • 2、获取 IP 地址
$ nslookup github.global.ssl.fastly.net
$ nslookup github.com
  • 修改 hosts 文件
    1、编辑 hosts
$ sudo vim /etc/hosts
  • 2、填入内容,保存
格式:
x.x.x.x http://global-ssl.fastly.net 
x.x.x.x http://github.com
例如拿上面得到的IP地址:
69.171.229.73 http://global-ssl.fastly.net 
13.250.177.223 http://github.com
  • nscd 命令更新 DNS 缓存
    1、如果没有安装,则需要安装一下
$ yum install -y nscd
  • 2、更新 DNS 缓存
$ nscd -i hosts
  • 然后再次执行 git clone,则会进入下载。
[root@VM-0-11-centos home]# git clone https://github.com/dengzemiao/DZMLuckyDraw.git
正克隆到 'DZMLuckyDraw'...
remote: Enumerating objects: 2644, done.
remote: Counting objects: 100% (2644/2644), done.
remote: Compressing objects: 100% (1562/1562), done.
接收对象中:   1% (41/2644), 897.00 KiB | 897.00 KiB/s


相关文章
|
1月前
|
开发工具 git C++
【git 实用指南】git下载、拉取 代码
【git 实用指南】git下载、拉取 代码
184 2
|
2月前
|
缓存 关系型数据库 MySQL
百度搜索:蓝易云【CentOS8服务器安装MySQL报错:no match mysql-community-server】
现在,你已经成功安装了MySQL服务器并解决了"no match mysql-community-server"的报错问题。祝你使用愉快!
43 1
|
3月前
|
Linux
CentOS7.9服务器一键脚本部署FRP内网穿透服务端与客户端
CentOS7.9服务器一键脚本部署FRP内网穿透服务端与客户端
232 0
|
3月前
|
Linux 网络安全
CentOS7服务器SSH登陆时自动显示服务器基础信息
CentOS7服务器SSH登陆时自动显示服务器基础信息
42 0
|
3月前
|
存储 Java 开发工具
WinServer服务器上搭建Git代码库
本文介绍如何在WinServer服务器上搭建Git代码库。
74 0
|
4月前
|
存储 Linux 虚拟化
CentOS 7搭建NFS服务器
CentOS 7搭建NFS服务器
|
4月前
|
安全 网络安全 开发工具
百度搜索:蓝易云【git无法使用git协议clone github仓库问题解决方法】
通过尝试以上解决方法,你应该能够解决无法使用Git协议克隆GitHub仓库的问题。选择适合你网络环境和要求的方法,并根据需要进行相应的配置。
185 2
|
4月前
|
分布式计算 Hadoop Java
我用免费白拿的服务器搭建了一台基于CentOS7的Hadoop3.x伪分布式环境
我用免费白拿的服务器搭建了一台基于CentOS7的Hadoop3.x伪分布式环境
56 0
|
18天前
|
Linux
centos 查看服务器信息 版本cpu
centos 查看服务器信息 版本cpu
12 0
|
1月前
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2
服务器Centos7 静默安装Oracle Database 12.2
86 0

热门文章

最新文章