31

I'm trying to sync my jb repository but I receive this odd error. funny thing is that it does not always crash at the same point (though it might be just a synchronization issue since I add -j10).

command: $ repo sync -j10

error: error: Exited sync due to fetch errors

I'm aware of the possibility of starting fresh but this is somewhat annoying and I get this issue often enough.

Can anyone suggest a faster solution?

dolbi
  • 2,180
  • 1
  • 19
  • 25

7 Answers7

58

Ok, so thanks for the effort, I found a similar question here

Summary:

Invoking $ repo sync -f -j10 did the trick.

As it seems -f or --force-broken flag allows it to recover from network error and more important recover on broken/missing objects.

dolbi
  • 2,180
  • 1
  • 19
  • 25
  • do you know what `-j10` means? – Ahmad Kayyali Apr 21 '14 at 07:10
  • thanks dolbi, i think it's the same as using `make -j 4` but N in make command indicates the number of cores – Ahmad Kayyali Apr 29 '14 at 11:59
  • in make N is still the number of tasks, Build everything with make. GNU make can handle parallel tasks with a -jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build. E.g. on a dual-E5520 machine (2 CPUs, 4 cores per CPU, 2 threads per core), the fastest builds are made with commands between make -j16 and make -j32. – SpyZip Dec 10 '14 at 08:17
  • 1
    @dolbi Thank you! This has saved me a lot of time!! – bluefalcon Oct 17 '17 at 04:23
  • `warning: -f/--force-broken is now the default behavior, and the options are deprecated` --force-sync still works. – rickfoosusa Aug 24 '22 at 19:25
9

repo sync -j1 -f --force-sync

fixed my cm13.0 sync error

ρss
  • 5,115
  • 8
  • 43
  • 73
FireLord
  • 101
  • 1
  • 1
5

There is a major factual error which most people know! People think, if repo sync fails, they have to download from the beginning again. But this is never true! Once repo sync is restarted after an error or manual termination, it just continues to sync from where it was terminated, updating only the existing files which were updated on github. Telling you from my experience.

And one more tip: After repo sync is completed, never ever delete the .repo folder. If you do so, the repo tool will start downloading all the code from the beginning rather than just updating them when you run repo sync afterwards!

serge.karalenka
  • 980
  • 1
  • 15
  • 29
Abitatha Roy
  • 51
  • 1
  • 3
  • I had some unwanted changes in multiple repositories and previously run `repo rebase` which only made the situation worse. `repo sync -f` was not able to complete because at least one repo had rebase in progress and other repo had wrong tracking information (corrupted manifest?) + some pushed but not merged commits. Force flag turned out to be useless in such situation. I just wanted the damn thing to replace my working tree with origin/master. `rm -rf && repo sync` did the job cleanly. Repo sync fails too often, but rm never. – Xeverous Jul 22 '19 at 15:52
2

Delete the projects in which u r getting the errors, then sync that project again. It worked for me.

ksam
  • 21
  • 1
2

I solved it by using force sync option.

repo sync --force-sync

Please try the same..... If still getting errors, then try system force i.e.

repo sync --force-sync system/core
  • 2
    There is already an answer which suggests force-sync. Consider upvoting the answer or commenting on the answer instead of posting a new answer. – vijayst Sep 04 '16 at 08:04
1

I have encountered this problem. I tried many times, but it did not work. Even that, I add the -f parameter some times.

Finally, I deleted the .repo/projects/xxx project , repo sync again, and it worked.

peterh
  • 11,875
  • 18
  • 85
  • 108
glen chang
  • 31
  • 4
0

Removing,

rm -rf .git/rebase-apply
rm -rf .git/refs

worked for me.

Tom Taylor
  • 3,344
  • 2
  • 38
  • 63