在国内git clone github仓库代码,常遇到速度慢,甚至连接中断问题。下面给出了两种简单方法。
方法一 (替换URL)
只需在 git clone 命令中将 gitclone.com 嵌入到克隆地址中即可
git clone https://gitclone.com/github.com/***.git
方法二(设置git参数)
这种方式,对于需要连续多个依赖的安装情况,尤其好用,一次性解决所有依赖的克隆下载问题。用完之后,git config的设置可以再改回来。
git config --global url."https://gitclone.com/".insteadOf https://
git clone https://github.com/***.git
用完之后,删除设置的命令如下。
git config --global --unset url.https://gitclone.com/.insteadof