我正在尝试下载 Android 源代码,并按照https://source.android.com/source/downloading.html中描述的步骤进行操作。该步骤包括安装 repo 脚本,然后运行以下命令:
$ repo init -u https://android.googlesource.com/platform/manifest
$ repo sync
获取主分支。我还尝试使用-f -j1
标志通过错误并仅使用一个核心,正如网上某处建议的那样。此时,我认为已非常接近下载整个内容,但在处理ipsec-tools时,它总是会在最后阶段停止。它总是给出以下输出:
Fetching project platform/external/ipsec-tools
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1 100 1 0 0 3 0 --:--:-- --:--:-- --:--:-- 3
100 1690k 100 1690k 0 0 2307k 0 --:--:-- --:--:-- --:--:-- 2307k
fatal: Not a git repository: '/home/sebastian/WORKING_DIR/.repo/projects/external/ipsec-tools.git'
fatal: Not a git repository: '/home/sebastian/WORKING_DIR/.repo/projects/external/ipsec-tools.git'
fatal: Not a git repository: '/home/sebastian/WORKING_DIR/.repo/projects/external/ipsec-tools.git'
Traceback (most recent call last):
File "/home/sebastian/WORKING_DIR/.repo/repo/main.py", line 500, in <module>
_Main(sys.argv[1:])
File "/home/sebastian/WORKING_DIR/.repo/repo/main.py", line 476, in _Main
result = repo._Run(argv) or 0
File "/home/sebastian/WORKING_DIR/.repo/repo/main.py", line 155, in _Run
result = cmd.Execute(copts, cargs)
File "/home/sebastian/WORKING_DIR/.repo/repo/subcmds/sync.py", line 635, in Execute
fetched = self._Fetch(to_fetch, opt)
File "/home/sebastian/WORKING_DIR/.repo/repo/subcmds/sync.py", line 339, in _Fetch
self._FetchProjectList(**kwargs)
File "/home/sebastian/WORKING_DIR/.repo/repo/subcmds/sync.py", line 234, in _FetchProjectList
success = self._FetchHelper(opt, project, *args, **kwargs)
File "/home/sebastian/WORKING_DIR/.repo/repo/subcmds/sync.py", line 275, in _FetchHelper
no_tags=opt.no_tags, archive=self.manifest.IsArchive)
File "/home/sebastian/WORKING_DIR/.repo/repo/project.py", line 1110, in Sync_NetworkHalf
no_tags=no_tags)):
File "/home/sebastian/WORKING_DIR/.repo/repo/project.py", line 1845, in _RemoteFetch
self.bare_git.pack_refs('--all', '--prune')
File "/home/sebastian/WORKING_DIR/.repo/repo/project.py", line 2483, in runner
p.stderr))
error.GitError: platform/external/ipsec-tools pack-refs: fatal: Not a git repository: '/home/sebastian/WORKING_DIR/.repo/projects/external/ipsec-tools.git'
由于它说它不是一个git仓库,我有点猜测并在所指示的目录上运行了git init
,但这并没有起作用。我还尝试删除整个ipsec-tools.git目录,并再次运行repo sync,以便从头开始,但它总是给出相同的错误。
有任何想法吗?
.repo/projects
下检出 git 存储库,然后在您的工作目录中创建到 git 存储库内容和该项目的.git
目录内容的适当路径,并通过符号链接将其指回.repo/projects
目录下的 git 配置文件。这似乎无法正确地拉取所有内容,可能是由于磁盘空间问题引起的。 - Larry Schieferrepo init
,然后执行了repo sync
,但由于磁盘空间不足而失败,然后尝试扩展磁盘并重新运行repo sync
,可能会导致git存储库处于奇怪的状态。你可以尝试清除你的工作目录并重新开始。或者,你可以尝试重新运行repo init
和repo sync
,但我过去使用这种方法的结果非常不一致。 - Larry Schieferrepo forall -vc "git init" && repo sync
对我来说有效。 - user2955935