回购同步无法初始化CM13工作树

时间:2016-03-16 20:32:05

标签: android git build android-source cyanogenmod

每当我尝试同步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

...此处&#34; repo --trace sync -l&#34;

: 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

我已经重试过&#34; repo sync&#34; (你看到的是&#34; repo sync -l&#34;它只在本地同步工作树)

非常感谢任何帮助。提前致谢:D

2 个答案:

答案 0 :(得分:7)

我遇到了同样的问题。以下是我修复它的方法:

  1. 看看导致问题的项目(在你的情况下是android / cm13 / hardware / qcom / audio-caf / msm8996。从你发布的第二个输出中)

  2. 删除该项目的文件夹(/ home / panos / android / cm13 / hardware / qcom / audio-caf / msm8996)

  3. 删除该项目的git目录(/home/panos/android/cm13/.repo/projects/hardware/qcom/audio-caf/msm8996.git和/ home / panos / android / cm13 /。回购/项目的对象/硬件/ QCOM /音频CAF / msm8996.git)

    1. 再次尝试运行repo sync。

答案 1 :(得分:0)

在我的情况下,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.

This post 的启发我尝试使用git://而不是http://来初始化我的回购,正如帖子所说的那样

$ repo init -u git://github.com/CyanogenMod/android.git -b cm-13.0

这解决了init问题。在那之后我同步了回购并且它首先尝试,没有错误,每一步都是100%。

快乐编码