git 错误 : cannot initialize work tree

标签 git

我正在尝试从其存储库下载特殊的 Android TV AOSP 代码。 我运行 repo init

repo sync -fc -j8 

像往常一样命令,但在获取所有内容后,我总是收到以下错误消息。

.
.
Fetching projects:  98% (431/439)  Fetching project platform/vendor/widevine
Fetching projects: 100% (439/439), done.  
Syncing work tree:  97% (426/439)  error: unable to read sha1 file of x86_64/vmlinux-qemu (11819c0a8aefd3cb8d0e87884ff44abda7bba2ad)
Traceback (most recent call last):
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/main.py", line 531, in <module>
_Main(sys.argv[1:])
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/main.py", line 507, in _Main
    result = repo._Run(argv) or 0
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/main.py", line 180, in _Run
    result = cmd.Execute(copts, cargs)
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/subcmds/sync.py", line 762, in Execute
    project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/project.py", line 1246, in Sync_LocalHalf
    self._InitWorkTree(force_sync=force_sync)
File "/home/mehmet/l_mrl-tv-dev-avko/.repo/repo/project.py", line 2387, in _InitWorkTree
    raise GitError("cannot initialize work tree")
error.GitError: cannot initialize work tree

它下载了大约 30GB 的数据,我已经尝试了很多东西,

我更新了 git 版本,删除了 ~/l_mrl-tv-dev-avko/.repo/repo 目录和 vmlinux-qemu 文件等。然后再次 checkout 但没有任何改变。

解决方案是什么? 问候

最佳答案

在 Windows 10 上,我在从 android.googlesource.com 同步 Android Studio 源时收到此错误。尽管删除了各种文件并再次尝试,但问题仍然存在,直到我选择创建 C:\src 并将其挂载到我的 Git Bash 窗口中的/src/。在我这样做之后,一切都完美同步。

关于git 错误 : cannot initialize work tree,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33165345/

相关文章:

git - CI : One git repository fits it all? 或者:多个项目的 gitflow

git - 尾随空格。补丁不适用

linux - 如何让 Git 在 Linux 上将 CRLF 文件转换为 LF?

git - tfs 服务器上的身份验证失败

Git:如何为 merge 创建补丁?

git - 使用git,如何在冲突期间执行 'use theirs'?

java - 带有自签名证书的 egit,https

windows - Git 扩展 "function not implemented"

macos - Git 配置 - 仍然询问用户名和密码

git - 将 GitHub 存储库移至 Raspberry Pi 上的私有(private)存储库