我们在开发的过程中经常用到repo工具,但是由于网络的原因经常下载失败,例如在下载Trusty代码的时候就遇到如下错误:
y@ubuntu:~/project/repo$ repo init -u https://android.googlesource.com/trusty/manifest -b master
Downloading Repo source from https://gerrit.googlesource.com/git-repo
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error [Errno 111] Connection refused
fatal: cloning the git-repo repository failed, will remove '.repo/repo'
那这个怎么解决呢,可以修改home 目录下的 .bashrc文件。
vim ~/.bashrc
在文件的末尾添加如下命令:
export PATH=~/bin:$PATH
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
保存文件后运行命令,使更改生效:
source ~/.bashrc
好了现在可以下载你要的源代码了。