当repo init时,执行的repo是环境变量里面默认的repo,这个repo只是单纯一个几百行的python脚本
而不是完整的repo-project,所以要先去网络远端sync完整的repo-project,
因为repo也是开源项目,设计者出于维护和使用体验,每次repo init时候都要从远端sync最新的版本
(浏览器开https://gerrit.googlesource.com/git-repo/clone.bundle可以看到维护的history,当然了,前提是当时网络可以通过GFW)
在repo init成功情况sync的project会在./.repo/repo这个路径,包含repo所有功能逻辑的python脚本,
而正是因为远端的git server的域名gerrit.googlesource.com会被GFW挡掉。
就会出现Network is unreachable,运气不好的时候可能一整天都没办法init成功。
.repo/repo/
├── docs
├── hooks
├── main.py
├── repo #真正的repo命令都会绕到这里执行
├── subcmds
└── tests
└── fixtures
【解决一】(推荐)
(该博客2016年更新)该问题可以通过增加如下option解决,该repo project有清华镜像源提供
--repo-url=https://gerrit-google.tuna.tsinghua.edu.cn/git-repo
https://gerrit-google.tuna.tsinghua.edu.cn/git-repo
同时清华TUNA源还提供完整android源码(AOSP),参考link :https://mirrors.tuna.tsinghua.edu.cn
721 def main(orig_args):
722 repo_main, rel_repo_dir = _FindRepo()
723 cmd, opt, args = _ParseArguments(orig_args)
724
725 wrapper_path = os.path.abspath(__file__)
726 my_main, my_git = _RunSelf(wrapper_path)
727
728 if not repo_main:
729 if opt.help:
730 _Usage()
731 if cmd == 'help':
732 _Help(args)
733 if not cmd:
734 _NotInstalled()
735 if cmd == 'init':
736 if my_git:
737 _SetDefaultsTo(my_git)
738 try:
739 _Init(args)
684 def _RunSelf(wrapper_path): #当前repo脚本所在目录中的main.py和.git信息
685 my_dir = os.path.dirname(wrapper_path)
686 my_main = os.path.join(my_dir, 'main.py')
687 my_git = os.path.join(my_dir, '.git')
//下载repo-project并用${Download_path}/repo/repo 来替换上一条中的repo,绕开sync直接init成功
我直接在CSDN上面上传了,是15年6月左右最新更新的版本:
http://download.csdn.net/detail/xiaokeweng/8872981