Reputation: 131
whenever I try to sync CM13 sources, I get this error:
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
...and here's "repo --trace sync -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
I have already retried "repo sync" (what you see is "repo sync -l" which only syncs the work tree locally)
Any help is greatly appreciated. Thanks in advance :D
Upvotes: 10
Views: 13959
Reputation:
I've had the same problem. Here's how I fixed it:
Look at which project is causing the problem (In your case android/cm13/hardware/qcom/audio-caf/msm8996. From the second output you posted)
Delete the folder of that project (/home/panos/android/cm13/hardware/qcom/audio-caf/msm8996)
Delete the git directories for that project (/home/panos/android/cm13/.repo/projects/hardware/qcom/audio-caf/msm8996.git and /home/panos/android/cm13/.repo/project-objects/hardware/qcom/audio-caf/msm8996.git)
Try running repo sync again.
Upvotes: 7
Reputation: 31
In my case the repo init command wasn't executed correctly and I didn't realice it for a while.
$ 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.
Inspired by This post I try to initialize my repo with git:// instead of http://, opposite as the post says
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-13.0
This solve the init problem. After that I sync the repo and it work at first try, with no errors, all 100% in every step.
happy coding
Upvotes: 0