http://source.android.com/source/downloading.html
1.下载repo
官网:curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
目前我是下载不了。
找了其他源,但如果repo下载不对,会提示“gpg: 无法检查签名:找不到公钥”
curl http://git-repo.googlecode.com/files/repo-1.13 > ~/bin/repo
sudo chmod a+x ~/bin/repo
2.初始化分支
下载所有分支信息,中途会要求配置邮箱和用户名
下载完成后可以去.repo/manifests目录下git branch -a查看
repo init -u https://android.googlesource.com/platform/manifest
切换分支
repo init -b android-4.4.2_r2
3.下载代码
repo sync -j4开四线程下
下载过程中遇到各种网络不稳定中断,一般重新下载就可以了
复制了份重复下载的代码:
#!bin/sh echo "====start repo sync====" repo sync -j4 while [$? == 1]; do echo "====sync failed, re-sync again===" sleep 3 repo sync -j4 done
目前下载了一下午了,第二天早上发现已经下载成功了。