6

I have two images in my repository that I want to remove: 1. "Côte d'Ivoire.png" 2. "Sao_Tomé_and_Príncipe.png"

If i delete them from Finder on a mac, git wants me to delete the file two times:

    deleted:    "src/assets/demo/img/flags/Co\314\202te_d'Ivoire.png"
    deleted:    "src/assets/demo/img/flags/C\303\264te_d'Ivoire.png"
    deleted:    "src/assets/demo/img/flags/Sao_Tome\314\201_and_Pri\314\201ncipe.png"
    deleted:    "src/assets/demo/img/flags/Sao_Tom\303\251_and_Pr\303\255ncipe.png"

I tried to just add all changes to staging and commit but then I ran into an issue when i tried to push the changes to the remote repo.

The tree object <id> was rejected: The tree contains duplicate or improperly sorted entries.

If i try to rename the files the same thing happens. It tries to delete both files two times and then add the new files with the new names.

I just can't figure out how I can remove them.

Edit: I had made some other commits after i deleted the files mentioned. I followed the steps mentioned in Tree contains duplicate file entries and figured out that the pictures was the issue.

I then tried to reset my branch to my remote branch, applied all other commits, deleted the mentioned files again, committed, pushed. This time it worked fine even though it actually deletes each file two times.

andbjer
  • 554
  • 2
  • 9
  • 1
    Did the commit succeed, and only push failed? Or does the error message you showed occur when you try to commit? – mkrieger1 Jan 10 '19 at 10:33
  • 1
    Though not directly related, the options mentioned in https://stackoverflow.com/questions/34549040/git-not-displaying-unicode-file-names might be worth looking at – gpgekko Jan 10 '19 at 10:34
  • This is terrifying. What is the hosting provider for the remote repo? – Edward Thomson Jan 10 '19 at 10:39
  • If it helps, trying this on ubuntu results in `delete mode 100644 "C\303\264te d'Ivoire.png"` and `delete mode 100644 "Sao_Tom\303\251_and_Pr\303\255ncipe.png"`. That suggests to me that the other two entries (`...\314\2...`) are incorrect. – Philip Couling Jan 10 '19 at 10:56
  • @mkrieger1 the commit succeeded. the push failed. I had also done some other work after this commit. Now I tried to reset my branch to my remote branch, applied all other commits, deleted the mentioned files again, committed, pushed. This time it worked fine. Not sure what the problem was the first time. – andbjer Jan 10 '19 at 11:09
  • 1
    I believe there is a buggy version of Git being distributed for MacOS. You probably have the buggy version. It makes broken internal index files, which then make broken tree objects. It's not clear what triggers the bug—someone who has a Mac, is *very* familiar with Git internals, and has the broken version *of* Git needs to debug it and find the problem in the Git source code and provide a fix. – torek Jan 10 '19 at 15:58
  • Does this answer your question? [Tree contains duplicate file entries](https://stackoverflow.com/questions/13178720/tree-contains-duplicate-file-entries) – Joe Hildebrand Sep 30 '20 at 22:12

0 Answers0