试了几天,终于解决了同步repo init失败的问题。谨此记录一下。希望对读者有用。
由于每个人的情况都不一样。所以我这里会列举我尝试的所有方法。
注意repo sync的问题不在本文讨论的范围内。
环境说明:
mac,10.15 0S,git
成功的结果:
目录下有.repo文件夹。在这个文件夹下包含:
- manifest.xml
- repo,文件夹
- manifests.git,文件夹
- manifests,文件夹
得到类似repo has been initialized in…,就是成功了
上面的文件就是我们需要下载到的。
遇到的问题
- 错误一摘要:error [Errno 60] Operation timed out
- 错误二摘要:
error [SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
(这种是开启vpn得到的错误)
解决方案
以下方案,我是通过第三种成功。
方式一:使用镜像
请参考清华镜像的使用:https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
方式二:手动替换REPO_URL
编辑bin/repo文件。
REPO_URL = os.environ.get('REPO_URL', None)
if not REPO_URL:
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
REPO_REV = os.environ.get('REPO_REV')
if not REPO_REV:
REPO_REV = 'stable'
另外几个地址:
git://codeaurora.org/tools/repo.git,高通的镜像(这个没有被墙)
https://gerrit-googlesource.proxy.ustclug.org/git-repo
方式三:clone git-repo
git clone https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
或git clone https://gerrit.googlesource.com/git-repo(需要翻墙)
将git-repo种的repo文件放入bin 中
将git-repo重命名为repo,放入.repo中
再次repo init
如果上述方式还是不可以,那就只能分析repo这个脚本的内容,repo的机制等等,尝试解决。
参考:
https://blog.csdn.net/SHNU_PFH/article/details/81484178
https://www.cnblogs.com/QUSIR/p/6337367.html