5

I'am cloning a git repository on my local pc. During this process the command outputs a lot of the following error messages:

error: non-monotonic index .git/objects/pack/._pack-*.idx

This messages stay on pull or on a branch-switch e.g, but everything seems to work. The local repository doesn't seem corrupted or something like that.

Any ideas about the error-messages?

Marc
  • 151
  • 1
  • 7
  • 16
  • I have only seen this happen so far when the version of `git` that was used for cloning was rather outdated in comparison to the version of `git` that was used to create the repository. Could you post some more details about version numbers (both *local* and *remote*)? – Gnosophilon May 22 '12 at 18:22
  • Local git client: 1.7.5.4, remote: 1.7.10 – Marc May 23 '12 at 13:54
  • That's a bit of a version discrepancy. Since you said that the error occurred on cloning, could you try updating your local git version? – Gnosophilon May 23 '12 at 18:31
  • I tried it with a 1.7.9 version (installed via homebrew on osx) - but the messages stay. It's a little bit wired .. I tried it on a windows machine and it worked without those messages. But there is a difference: The local repository on windows just has one big idx file, on osx are many idx-files - the one mentioned in my opening post and the "normal" pack-*.idx/pack files .. don't know if it has something to say. Anyways .. it's a little bit confusing that the repository seems to be ok on osx - I can switch branches and pull changes .. the repository seems not to be broken. – Marc May 24 '12 at 14:35
  • Some words to the repo: The remote repository is located on a storage service (cloud stuff) that I'am accessing by webdav. Same on Windows. On Windows the git client is executing some remote operations (count objects e.g.) - the mac client doesn't do/output something like that. Could that mean something? – Marc May 24 '12 at 15:01
  • 2
    For me removing the these curropted *.idx and *.pack files solved the problem – Zaki Dec 01 '14 at 11:54
  • I ran into the same problem using code that was created with a much older version of git and the latest version of git installed on my PC. Deleting the ._ * files didn't, but this did: rm .git/objects/pack/._pack-049147e29fd8bdddd5a9172ac6620e9db2f2f317.idx – Joe Bigler Oct 05 '16 at 19:43

4 Answers4

1

Looks to me like these are just a bunch of ._ files created by OSX and git doesn't understand it needs to ignore them. I had this same problem with tons of files like that. Just deleting ._* seems to have solved it.

boxed
  • 3,895
  • 2
  • 24
  • 26
1

I was searching for info in this kind of non-monolitic error and found this link: http://git.661346.n2.nabble.com/Error-non-monotonic-index-after-failed-recursive-quot-sed-quot-command-td7575014.html

TL;DR: you remove the non-monolotic index and then reindex it. In linux it would be:

> rm .git/objects/pack/pack-*.idx
> git index-pack .git/objects/pack/pack-*.pack 

After this I had to run some git gc --prune=now and git remote prune origin, but I had done some other operations before so I may have spoiled my repo.

Brenes
  • 311
  • 3
  • 6
  • The index-pack command seems to only take one argument. But you can use this instead: `for f in .git/objects/pack/pack-*.pack; do git index-pack $f; done` – Sunny Apr 28 '21 at 19:21
1

File with names like "._pack-*.idx" are generated on a MacOS system when you move your repository around.

Look in the location where you have your remote repository: my-repo.git/object/pack. In here you will have your normal pack*idx files and the ones generated by MacOS with the same name but prefixed with ._

Remove them and your repo will be ok.

Iuliana Cosmina
  • 124
  • 1
  • 5
-1

On MacOS, if you try to save your local repo on a mounted volume, e.g. a network drive, deleting the ._* files will not work because they are created all over again. Instead, add ._* to your .gitignore to let git ignore those files.

In case this doesn't work, your .gitignore might be the problem. Open the .gitignore using a text editor, save it as UTF-8 and run the following commands in the terminal:

git rm -r --cached .
git add .
ATellB
  • 1
  • 2
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33691384) – hakre Jan 28 '23 at 13:30
  • If you have a problem with the file-system, it is likely not useful to solve it on the level of a projects - perhaps even subtree - .gitignore file. Consult the Git documentation on how to configure it for your system. – hakre Jan 28 '23 at 13:32