repo

1.下载repo

sudo snap install git git-repo    
mkdir   ~/temp
cd  ~/temp

google

curl http://gerrit.googlesource.com/git-repo/repo > ~/temp/repo

国内

curl [https://mirrors.tuna.tsinghua.edu.cn/git/git-repo](https://mirrors.tuna.tsinghua.edu.cn/git/git-repo) -o repo

curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/temp/repo
chmod a+x ~/bin/repo

2.环境变量
临时

PATH=~/temp:$PATH

永久 如添加.zshrc

export PATH=~/temp:$PATH
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

这里的repo只是一个引导脚本而不是直接称之为repo,因为repo大部分功能代码都不在其中,下载的只是帮助整个repo程序继续下载和加载的工具。

初始化:
Android官方

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-12.0.0_r16

或私有仓库

repo init -u ssh://xxxx@192.168.0.241:29418/xxx/manifest -b default

同步

repo sync 

--------------------------------------------抄大佬的脚本-------------------------------------------------------------
Ubuntu 18.0.4

### Step 4. install AOSP

# install repo
sudo apt install repo

# repo init (just a try, then would occur the problem concerning with python2)
VERSION="android-11.0.0_r1"
repo init -u https://android.googlesource.com/platform/manifest -b $VERSION

# change default python from 2 to 3 (don't run this before first repo init, otherwise causing another problem)
sudo sed -i '1s/python/python3/' /usr/bin/repo

# repo init again
repo init -u https://android.googlesource.com/platform/manifest -b $VERSION

# !IMPRTANT: set the mirror into chinese, otherwise would cost a lot of net flow
# there are two mirrors recommended, one is from TUNA: `https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/` and another is BFSU: `https://mirrors.bfsu.edu.cn/git/AOSP/`
AOSP_MIRROR="https://mirrors.bfsu.edu.cn/git/AOSP/"
git config --global url.${AOSP_MIRROR}.insteadof https://android.googlesource.com

# repo sync 
repo sync -j32


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容