Reporepo sync:error.GitError: cannot initialize work tree
Posted wucaiyun1
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Reporepo sync:error.GitError: cannot initialize work tree相关的知识,希望对你有一定的参考价值。
1.Error
Fetching projects: 100% (725/725), done.
Checking out files: 100% (4605/4605), done.out files: 41% (1902/4605)
Checking out files: 100% (4371/4371), done.out files: 2% (89/4371)
Checking out files: 100% (48/48), done.king out files: 35% (17/48)
Checking out files: 100% (13649/13649), done.ut files: 43% (5897/13649)
Checking out files: 100% (9868/9868), done. out files: 33% (3318/9868)
Checking out files: 100% (21681/21681), done.ut files: 14% (3196/21681)
Checking out files: 100% (5902/5902), done. out files: 40% (2407/5902)
Checking out files: 100% (278/278), done.ng out files: 48% (134/278)
Checking out files: 100% (677/677), done.ng out files: 36% (247/677)
Checking out files: 100% (5491/5491), done. out files: 37% (2055/5491)
Checking out files: 100% (43496/43496), done.ut files: 6% (2893/43496)
Checking out files: 100% (16115/16115), done.
Checking out files: 100% (2626/2626), done. out files: 37% (985/2626)
Checking out files: 100% (3081/3081), done. out files: 45% (1389/3081)
Checking out files: 100% (33649/33649), done.ut files: 1% (401/33649)
Checking out files: 100% (2822/2822), done. out files: 25% (725/2822)
Checking out files: 100% (60891/60891), done.ut files: 12% (7317/60891)
Checking out files: 100% (4780/4780), done. out files: 22% (1077/4780)
Checking out files: 100% (3472/3472), done. out files: 44% (1542/3472)
fatal: failed to unpack tree object HEAD
Traceback (most recent call last):
File "/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/android/.repo/repo/main.py", line 500, in <module>
_Main(sys.argv[1:])
File "/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/repo/main.py", line 476, in _Main
result = repo._Run(argv) or 0
File "/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/repo/main.py", line 155, in _Run
result = cmd.Execute(copts, cargs)
File "/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/repo/subcmds/sync.py", line 675, in Execute
project.Sync_LocalHalf(syncbuf)
File "/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/repo/project.py", line 1170, in Sync_LocalHalf
self._InitWorkTree()
File "/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/repo/project.py", line 2230, in _InitWorkTree
raise GitError("cannot initialize work tree")
error.GitError: cannot initialize work tree
2.Solution
①repo --trace sync -cdf将repo的所有动作详细输出:
repo --trace sync -cdf
: unpickle /home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/manifests.git/config
: unpickle /home/lenovosh/.gitconfig
: unpickle /home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/repo/.git/config
: export GIT_DIR=/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/manifests.git
: git fetch origin --tags +refs/heads/release:refs/remotes/origin/release
: load refs /home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/manifests.git
: scan refs /home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/manifests.git
Fetching project platform/packages/apps/Car/Cluster
: unpickle /home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/projects/packages/apps/Car/Cluster.git/config
: export GIT_DIR=/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/projects/packages/apps/Car/Cluster.git
: git rev-parse --verify fa927c0de153e238013497a16f64007bfb89a780^0 1>| 2>|
: load refs /home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/projects/packages/apps/Car/Cluster.git
: scan refs /home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/projects/packages/apps/Car/Cluster.git
Fetching project platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
: unpickle /home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/projects/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8.git/config
: export GIT_DIR=/home/lenovosh/Qualcomm/SourceCode/mirror/SDM845_r00110.1/Android/.repo/projects/prebuilts/android-emulator.git
: git rev-parse --verify cbdfa5df4f2105148cc2fa6ce4ddf3bc1695b488^0 1>| 2>|
: git rev-parse --verify cbdfa5df4f2105148cc2fa6ce4ddf3bc1695b488^0 1>| 2>|
: git fetch caf --tags +refs/heads/ks-aosp.lnx.2.0.r1-rel:refs/remotes/caf/ks-aosp.lnx.2.0.r1-rel
remote: Counting objects: 8539, done.
remote: Compressing objects: 100% (1256/1256), done.
Receiving objects: 58% (4966/8539), 94.70 MiB | 12.00 KiB/s
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
: git rev-parse --verify cbdfa5df4f2105148cc2fa6ce4ddf3bc1695b488^0 1>| 2>|
: git fetch caf --tags +refs/heads/*:refs/remotes/caf/*
remote: Counting objects: 8552, done.
remote: Compressing objects: 100% (1269/1269), done.
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
: git fetch caf --tags +refs/heads/*:refs/remotes/caf/*
remote: Counting objects: 8553, done.
remote: Compressing objects: 100% (1270/1270), done.
②因此,将prebuilts/android-emulator这个文件夹删除,在.repo/projects下删除.repo/projects/prebuilts/android-emulator.git目录,以及.repo/project-objects/prebuilts/android-emulator.git目录
③最后重新repo sync即可
以上是关于Reporepo sync:error.GitError: cannot initialize work tree的主要内容,如果未能解决你的问题,请参考以下文章