首页 > 解决方案 > 错误:无法获取 linaro-swg/arm-trusted-firmware.git

问题描述

我正在尝试按照以下过程在 linux Ubuntu OS 上构建 OP-TEE https://optee.readthedocs.io/building/gits/build.html#get-and-build-the-solution

在第 3 步中,使用命令“$ repo sync -j4 --no-clone-bundle”,出现如下错误信息:

错误:无法获取 linaro-swg/arm-trusted-firmware.git(GitError:--force-sync 未启用;无法覆盖本地工作树。如果您对丢失工作树的 git 元数据的可能性感到满意,请使用repo sync --force-sync arm-trusted-firmware继续。)线程 Thread-9 中的异常:

我该怎么做才能获取 linaro-swg/arm-trusted-firmware.git?

谢谢

标签: git

解决方案


正如H. Mijail 的博客上所说,在repo sync --force-sync 中会覆盖您现有的存储库!

看起来 repo 会跟踪它已经启动的存储库。
因此,如果您独立于 repo 创建了一个存储库,然后将该现有存储库的条目添加到 repo 清单,repo sync 将阻塞并向您显示消息:

error.GitError: --force-sync not enabled; cannot overwrite a local work tree. If you're comfortable with the possibility of losing the work tree's git metadata, use `repo sync --force-sync mydirectory` to proceed.

原来“git 元数据”是指.gitmydirectory 中的整个目录。
因此,现有本地存储库中的任何分支、任何存储、任何内容都将被销毁。也没有办法重新登录!

运行repo --force-sync后,repo 将在进一步的 repo 同步调用中接受存储库。

使用的替代方法--force-sync可能是使用--force-break(或简单地-f),它只会在任何目录无法同步时继续。
但是我没有尝试,如果我们假设 repo 没有进入它没有创建的目录,我什至不知道这会有什么意义。

无论如何...首先备份您的本地存储库!


推荐阅读