Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git LFS always shows image files as changed?

Tags:

git

git-lfs

I just set up Git LFS for a project, and for non-image files (precompiled libraries, for instance) it is working great. But all of the .png and .jpg files are showing as always modified, even if I try to reset (git checkout --) them.

The entries all look the same in .gitattributes:

*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text

The output of git diff isn't terribly useful:

diff --git a/Design/faviconit/favicon.ico b/Design/faviconit/favicon.ico
index 3202014..b5d3daf 100755
Binary files a/Design/faviconit/favicon.ico and b/Design/faviconit/favicon.ico differ

I'm not sure what other steps I should take to diagnose the problem. Has anyone else run into this? Any ideas? Thanks!

Updates:

It actually isn't all the image files, just a subset of them. But only image files are showing the problem.

I tried removing all of the problematic images and pushing that commit. Then on a different machine I added a few of the files back and pushed again. When I pulled the new changes, I got the same issue: the files immediately show as modified. The files look correct on disk, and are in fact identical to the originals.

like image 731
J. Perkins Avatar asked Dec 21 '15 12:12

J. Perkins


1 Answers

D'oh…after much checking in and out and pushing and pulling from various machines on the network we found one where git lfs install had not been run on the local working copy. So it was pushing raw binary files instead of the LFS text records.

To fix it, we had to run the init command, and then commit and push all of the broken files (after verifying that we had staged the LFS text records and not the images themselves).

Hopefully LFS can get bundled into the Git distribution at some point and avoid this issue.

like image 52
J. Perkins Avatar answered Sep 21 '22 00:09

J. Perkins