Wow 107F/42C in Seattle, working outside and git lfs

Nothing like pretending like it is Hawaii in the Pacific Northwest, our little neck of the woods hit 107F or 42C which is really unusual, but that doesn’t stop the work, so I hit a bunch of git lfs bugs again. As a reminder, if you get the dreaded “files should be pointer but weren’t” what it means is that sometime you had a file like say “new.jpeg” which wasn’t treated as a git lfs entry, but then you add it.

Now, Git LFS can get confused. So you have to reset the whole thing with:

# first git lfs and then the reset hard gives you real files back
git lfs uninstall
git reset --hard
# now install it and the pull with fix the pointers
git lfs install
git lfs pull

For the curious what is going on here is that, when you install Git LFS, it replaces all the files it is storing like foo.jpeg with a pointer instead of the actual data. Then when you do a git lfs track "*.jpeg" you are telling git lfs to find all the jpeg files and replace them with the pointer. The pointer is what gets pushed into the repo and when you do a git lfs pull it will give you those files.

However, if you have a jpeg already there, then git expects to see a pointer, but instead gets the real data. The cleanup above reverses all of it, so you just get real data files and then the git lfs install does the copy magic and all is well.

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect