There are many examples of Android's source code compilation online.
What I want to say here is that those who write examples should be given more fish than people.
such as download source code, well-known reasons, can not download the original site. Take the mirror site of Tsinghua University for example (https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/), on the website is very clear how to replace the link address.
Many articles say to download a version, run first
Repo Init-u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest-b ANDROID-5.1.1_R4
In fact, according to the Tsinghua website should be (HTTPS link)
Repo Init-u https://aosp.tuna.tsinghua.edu.cn/android/platform/manifest-b ANDROID-5.1.1_R4
Next question, to download the repo file to the ~/bin directory, you can go to this directory and run git clone git://aosp.tuna.tsinghua.edu.cn/android/git-repo.git/without moving it again.
This repo file does not seem to change the address inside.
The next question, since it is to see the tutorial, it must be unfamiliar with a lot of processes. In this download, set up your git account first.
git config--global user.email "[Email protected]"
git config--global user.name "Your name"
To avoid fatal:unable to Auto-detect email address this error.
Recommend an address (to give an example of fishing) https://www.jianshu.com/p/367f0886e62b
Android Source Download