The red font indicates the option that is being selected.
Install curl
$ Sudo apt-get install curl
Install the git Tool(Install the latest version as follows)
Add ppa
$ Sudo apt-add-repository ppa: git-core/ppa
$ Sudo apt-get update
$ Sudo apt-get install git
Git version is the latest
$ Git -- version
Git version 1.8.5.2
Error: sudo apt-add-repository ppa: git-core/ppa error: gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com/gpgkeys: HTTP fetch error 7: couldn't connect to host
Cause: keyserver.ubuntu.com uses a non-standard port 11371, Which is blocked by the company's firewall and the standard port 80 is allowed.
Therefore, you can use port 80 to add software sources as follows:
$ Sudo apt-key adv -- recv-keys -- keyserver hkp: // keyserver.ubuntu.com: 80 E1DF1F24
The green part is the Key you want to request.
Download repo Tool
Google tells us this:
$ Curl http://commondatastorage.googleapis.com/git-repo-downloads/repo> ~ /Bin/repo
$ Chmod a + x ~ /Bin/repo
But it seems that it cannot be accessed.
Solution: http://code.google.com/p/git-repo/downloads/detail? Name = repo-1.12 this link provides download repo!
You can also run the following command:
$ Curl http://git-repo.googlecode.com/files/repo-1.12> ~ /Bin/repo
I added a 1.20 s download after http. Actually, no other version of the error is returned.
$ Curl https://commondatastorage.googleapis.com/git-repo-downloads/repo>./repo
The specific repo version can go to view information on the http://code.google.com/p/git-repo/downloads page, download that version is OK.
Modify execution permission
$ Chmod a + x repo
Repo init create warehouse
Initialize the android source code and download the latest code.
$./Repo init-u https://android.googlesource.com/platform/manifest
Or get a branch like this like a android-4.4.2_r1
$./Repo init-u https://android.googlesource.com/platform/manifest-B android-4.4.2_r1
If you need to download another branch, change the android-4.4.2_r1 to another branch name. Branch name please view branch in https://android.googlesource.com/platform/manifest/+refs
Execute repo sync for synchronization
$./Repo sync
When you use repo sync to synchronously download code, the code may be frequently disconnected due to network reasons. You can use the following script to create a script file and automatically download it after it is interrupted.
Create script download. sh
#! /Bin/bash
Echo ========= start repo sync ======================
./Repo sync
While [$? = 1]; do
Echo ===== sync failed, re-sync again ======
Sleep 3
./Repo sync
Done
Chomd a + x download. sh allows it to run, and then enter./download. sh on the terminal to start downloading. Use this step to replace repo sync in the official document. When the terminal cannot be connected, the system takes 3 ms of rest and then automatically repo sync.