Odd problem with Git, Windows and virus-checkers

Had a really odd git problem this week, with an even odder solution, so am posting in the hope of helping the next poor dev who has to try and track this down via Google.

We had a branch checked out with 2 new commits on it, and we wanted to squash it into a single commit using git rebase -i (basecommit). This would start the normal interactive rebase, then get into a loop of printing the following error to console:

mv: cannot move '.git/rebase-merge/git-rebase-todo.new' to '.git/rebase-merge/git-rebase.todo'

Looking at the .git/rebase-merge folder, I could see the git-rebase-todo.new file getting repeatedly created, then deleted. This was happening on two different machines.

Some googling lead me to this post which suggested a virus checker may be locking the file.

Sure enough, turning off Microsoft Security Essentials’ Real-time protection, doing the rebase, then turning it back on again, resolved the problem. I’ve never had this problem before so must have just gotten “lucky” with this particular file matching some property the virus checker was looking for.

I guess this is probably worth trying whenever getting strange file IO errors from any software ported to Windows.

Comments