由于国内(中国)网络特殊缘故,无法直接通过 https://android.googlesource.com 同步代码,但是清华开源镜像站会有安卓源码同步仓库,可以利用清华源同步安卓源码,并且速度非常快。

替换全局 git 克隆地址

在终端执行

Google

git config --global url.https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/.insteadof https://android.googlesource.com

高通

git config --global url.https://source.codeaurora.cn.insteadof https://source.codeaurora.org

GitHub

git config --global url.https://github.com.cnpmjs.org.insteadof https://github.com

即可完成国内源地址替换。

任何情况下进行 git clone https://android.googlesource.com/platform/xxx 操作,git 默认使用清华源仓库地址代替。

当同步任何安卓源码时,如lineageOS、Mokee 等,90% 流量来自清华源,其余存储在GitHub仓库的repo 则按正常流量同步。

最后修改:2021 年 09 月 08 日
如果觉得我的文章对你有用,请随意赞赏