Marc
Marc

Reputation: 171

Git - "non-monotonic index"

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?

Upvotes: 7

Views: 5302

Answers (5)

parham
parham

Reputation: 61

you can remove these files.

find "${1:-.}" -type f -name '._*' -exec rm -v {} \;

Upvotes: 0

ATellB
ATellB

Reputation: 39

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 .

Upvotes: -1

Iuliana Cosmina
Iuliana Cosmina

Reputation: 134

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.

Upvotes: 2

Brenes
Brenes

Reputation: 351

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.

Upvotes: 2

boxed
boxed

Reputation: 4417

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.

Upvotes: 3

Related Questions