repo是个python脚本用于管理多个git仓库。
- 正常安装repo的过程为
shell
curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo && chmod a+x /usr/bin/repo
其作用就是获取repo脚本内容输出到/usr/bin/repo中,然后给/usr/bin/repo赋予可执行权限。
- 国内安装repo过程
由于国内无法访问https://storage.googleapis.com/git-repo-downloads/repo,因此需要改用国内镜像,这里使用清华镜像
shell
curl -L https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o /usr/bin/repo && chmod a+x /usr/bin/repo
每次在执行repo指令的时候repo都要检测自己是否需要更新,repo会读取环境变量REPO_URL去获取更新地址。默认还是访问google,因此我们需要设置REPO_URL的值,让其指向国内镜像地址。
在~/.bashrc中添加export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'

重启终端就可以正常使用repo了。