国内GitHub加速clone方法 |
您所在的位置:网站首页 › git克隆太慢 › 国内GitHub加速clone方法 |
GitHub加速
在github上下载clone源码过慢的问题,甚至失败问题。加速解决方案如下: 方法一、使用"码云"中转下载。使用’码云’平台做中转,先将项目导入’码云’,再从’码云’平台clone,很快。 注册登录"码云",码云。 点击右上角新建仓库的加号+,选择“从GitHub/GitLab导入仓库”菜单。 填写想clone的仓库地址。 码云clone项目非常快,等待导入完成。 导入完成后,使用码云生成的地址clone项目。 重新关联远程地址。 文本编辑器打开项目.git文件夹中的config配置文件。(.git文件是隐藏文件夹)。 将配置文件中的[remote "origin"].url字段重新关联到原来位于GitHub上的GitHub项目地址。 方法二、替换原URL使用国内镜像源替换。将url中github.com替换为镜像地址github.com.cnpmjs.org 如: git clone https://github.com/flutter/flutter.git替换为: git clone https://github.com.cnpmjs.org/flutter/flutter.git 方法三、使用gitclone.com平台clone从GitHub缓存加速网站clone。 使用如下: 方法一(替换URL) git clone https://gitclone.com/github.com/tendermint/tendermint.git 方法二(设置git参数) git config --global url."https://gitclone.com/".insteadOf https:// git clone https://github.com/tendermint/tendermint.git 方法三(使用cgit客户端) cgit clone https://github.com/tendermint/tendermint.git 方法四、修改hosts文件。在国内IP查询网站(https://www.ipaddress.com/)上查询: github.com assets-cdn.github.com github.global.ssl.fastly.net 等的地址,然后修改host文件。 MAC电脑中打开终端 sudo vi /etc/hosts参看:https://zhuanlan.zhihu.com/p/65154116 方法五、配置代理。在你有代理能上网的前提下,仅仅针对github进行配置,让github走本地代理,其他的保持不变; # socks5协议,1080端口修改成自己的本地代理端口 git config --global http.https://github.com.proxy socks5://127.0.0.1:1080 git config --global https.https://github.com.proxy socks5://127.0.0.1:1080 # http协议,1081端口修改成自己的本地代理端口 git config --global http.https://github.com.proxy https://127.0.0.1:1081 git config --global https.https://github.com.proxy https://127.0.0.1:1081 # 查看所有配置 git config -l # reset 代理设置 git config --global --unset http.proxy git config --global --unset https.proxy参看:https://juejin.im/post/6844903862961176583 总结下:推荐方法二,方法三,方法一 推荐方法二,方法三,见效快。方法一麻烦点,很快切有效。方法四很多时候没什么用。方法五要能科学上网。查资料上网可以使用googleHelper。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |