repo sync导致"致命:不是git存储库:'working_dir/.repo/projects/external/ipsec-tools.git'"

sch*_*low 3 git android android-source

我正在尝试下载Android源代码,并遵循https://source.android.com/source/downloading.html中描述的过程,其中包括安装repo脚本然后运行

$ repo init -u https://android.googlesource.com/platform/manifest
$ repo sync
Run Code Online (Sandbox Code Playgroud)

获得主要分支.我也尝试使用-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'
Run Code Online (Sandbox Code Playgroud)

因为它说它不是一个git存储库,所以我只是继续前进并在git init它指示的目录上运行,但这不起作用.我还尝试删除整个ipsec-tools.git目录并再次运行repo sync,以便它从头开始,但它总是给出相同的错误.

有任何想法吗?

小智 7

它没有必要sync从头开始.Android是一个从头开始下载的大型存储库,为了节省时间和互联网,可以删除特定的git存储库(通常我只看到1个git目录已损坏)并重新运行同步.

repo 将项目存储在

.repo/projects
Run Code Online (Sandbox Code Playgroud)

但这些只是存储在其中的实际git数据的软链接

.repo/project-objects
Run Code Online (Sandbox Code Playgroud)

按照"项目"中的链接删除两个存储库并再次运行同步.它对我有用.

平台/框架/支持的示例:

rm -fr .repo/projects/frameworks/support.git/ .repo/project-objects/platform/frameworks/support.git/
Run Code Online (Sandbox Code Playgroud)

仅同步此项目:

repo sync -j4 platform/frameworks/support
Run Code Online (Sandbox Code Playgroud)

[我想将此添加为评论,但它不允许我 - 所以添加为答案]