当在克隆或从远程仓库获取数据时,很可能因为网络状况不佳遇到很慢甚至超时的情况,那么此时您可能需要配置 Git 的代理。
第一种:使用镜像站
最常见 GitHub 镜像地址:
https://gitclone.com/
https://hub.fastgit.org/
https://github.com.cnpmjs.org/
访问上面的镜像网站,网站的内容跟 GitHub 是完整同步的镜像,然后在这个网站里面进行下载克隆等操作。
举个栗子: git clone https://github.com/microsoft/vscode.git
替换为 :git clone https://gitclone.com/github.com/microsoft/vscode
第二种 设置git参数
1 | git config --global url."https://gitclone.com/".insteadOf https:// |
第三种 使用cgit工具
下载链接:https://github.com/git-cloner/gitcache/releases
1 | cgit clone https://github.com/microsoft/vscode.git |
第四种 使用本地代理
1 | # 设置代理 |