每当我尝试同步 CM13 源时,都会收到此错误:
panos@ubuntu:~/android/cm13$ repo sync -l
Syncing work tree: 67% (344/512) fatal: This operation must be run in a work tree
Traceback (most recent call last):
File "/home/panos/android/cm13/.repo/repo/main.py", line 531, in <module>
_Main(sys.argv[1:])
File "/home/panos/android/cm13/.repo/repo/main.py", line 507, in _Main
result = repo._Run(argv) or 0
File "/home/panos/android/cm13/.repo/repo/main.py", line 180, in _Run
result = cmd.Execute(copts, cargs)
File "/home/panos/android/cm13/.repo/repo/subcmds/sync.py", line 769, in Execute
project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
File "/home/panos/android/cm13/.repo/repo/project.py", line 1247, in Sync_LocalHalf
self._InitWorkTree(force_sync=force_sync)
File "/home/panos/android/cm13/.repo/repo/project.py", line 2393, in _InitWorkTree
raise GitError("cannot initialize work tree")
error.GitError: cannot initialize work tree
...这是“repo --tracesync -l”
: export GIT_DIR=/home/panos/android/cm13/.repo/projects/hardware/qcom/audio-caf/msm8996.git
: git rev-parse --verify refs/remotes/github/cm-13.0-caf-8996^0 1>| 2>|
: cd /home/panos/android/cm13/hardware/qcom/audio-caf/msm8996
: git read-tree --reset -u -v HEAD 1>| 2>|
fatal: This operation must be run in a work tree
Traceback (most recent call last):
File "/home/panos/android/cm13/.repo/repo/main.py", line 531, in <module>
_Main(sys.argv[1:])
File "/home/panos/android/cm13/.repo/repo/main.py", line 507, in _Main
result = repo._Run(argv) or 0
File "/home/panos/android/cm13/.repo/repo/main.py", line 180, in _Run
result = cmd.Execute(copts, cargs)
File "/home/panos/android/cm13/.repo/repo/subcmds/sync.py", line 769, in Execute
project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
File "/home/panos/android/cm13/.repo/repo/project.py", line 1247, in Sync_LocalHalf
self._InitWorkTree(force_sync=force_sync)
File "/home/panos/android/cm13/.repo/repo/project.py", line 2393, in _InitWorkTree
raise GitError("cannot initialize work tree")
error.GitError: cannot initialize work tree
我已经重试了“reposync”(您看到的是“reposync-l”,它仅在本地同步工作树)
非常感谢任何帮助。预先感谢:D
删除答案以抗议 StackOverflow 的 OpenAI 合作伙伴关系:https://stackoverflow.co/company/press/archive/openai-partnership
就我而言,repo init 命令没有正确执行,我有一段时间没有意识到这一点。
$ repo init -u http://github.com/CyanogenMod/android.git -b cm-13.0
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get https://gerrit.googlesource.com/git-repo
Get http://github.com/CyanogenMod/android.git
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
受到这篇文章的启发我尝试使用 git:// 而不是 http:// 来初始化我的存储库,与帖子所说的相反
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-13.0
这解决了初始化问题。之后,我同步存储库,第一次尝试就可以工作,没有错误,每一步都 100%。
快乐编码