
SDK 使用 Repo 工具管理,拉取 SDK 需要配置安装 Repo 工具。
Repo is a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to revision control systems, and automates parts of the development workflow. Repo is not meant to replace Git, only to make it easier to work with Git. The repo command is an executable Python script that you can put anywhere in your path.
Repo官网:git-repo
可以用包管理器进行安装:
# Debian/Ubuntu.
$ sudo apt-get install repo
# Gentoo.
$ sudo emerge dev-vcs/repo也可以手动单独安装:
$ mkdir -p ~/.bin
$ PATH="${HOME}/.bin:${PATH}"
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
$ chmod a+rx ~/.bin/repo国内镜像源安装:
$ mkdir -p ~/.bin
$ PATH="${HOME}/.bin:${PATH}"
$ curl https://mirrors.bfsu.edu.cn/git/git-repo > ~/.bin/repo
$ chmod a+rx ~/.bin/repo由于谷歌服务器位于国外,每次运行时Repo会检查更新导致下载较慢,国内用户可以配置镜像源。否则会像下图一样卡住不动然后失败。

Repo 的运行过程中会尝试访问官方的 git 源更新自己,更换镜像源可以提高下载速度。将如下内容复制到你的~/.bashrc 里
$ echo export REPO_URL='https://mirrors.bfsu.edu.cn/git/git-repo' >> ~/.bashrc
$ source ~/.bashrc如果您使用的是 dash、hash、 zsh 等 shell,请参照 shell 的文档配置。
新版本 git 默认加强了安全性,身份认证不会保存,导致拉取 repo 需要多次输入密码,可以用下列命令配置:
git config --global credential.helper store
Downloading Repo source from https://gerrit.googlesource.com/git-repo 不动。
sudo git config --global credential.helper store 使用了 sudo 后保存的信息会存储到 root 用户下并非当前用户。fatal: cannot make directory: File exists
.repo 文件夹重新拉取