Timeliness note: The mirror URLs in this article were valid for a specific period. Both TUNA (Tsinghua) and USTC (Hefei) AOSP mirror addresses have changed multiple times. Always consult each mirror’s official help page for current URLs.
AOSP source is enormous (~70GB), making downloads from Google’s official servers via VPN painfully slow. Chinese mirrors offer much faster speeds.
Replacing the Remote URL
Replace https://android.googlesource.com/ with the TUNA mirror:
| |
For an existing checkout, modify the aosp remote fetch URL in .repo/manifest.xml:
| |
Download the repo Tool
| |
Initialize the Working Directory
| |
If gerrit.googlesource.com is unreachable, edit ~/bin/repo and change the REPO_URL line:
| |
Sync the Source Tree
| |
Run this command repeatedly to keep the source tree up to date.
Switching an Existing Repo to a Chinese Mirror
Edit .repo/manifests.git/config, change:
| |
to:
| |
This method also works for syncing CyanogenMod code from TUNA.