0

I have had git LFS enabled on my repository for a while and it has always worked perfectly. Recently, I have been having issues where my local files are being replaced with links.

As an example, I have a png file that will no longer open because the file format is not supported. Upon opening the file in notepad, I am presented with this.

version https://git-lfs.github.com/spec/v1
oid sha256:733c51c9ee6f0f395f5f042869307154d6ebf6d5d5e3bc10e2af68a432903bf0
size 5104

Many of my files are being replaced with these links and my programs that are accessing these files are throwing errors as they are unable to read them.

I am working in Windows 10, I have git lfs installed, I am using git-bash on the Windows Cmd line. I believe that when I was installing git-bash, I enabled symbolic links, I am unsure if that could potentially be causing the issue.

If you need more information, please let me know. I really appreciate everyone's help!

torek
  • 448,244
  • 59
  • 642
  • 775
Chris McCole
  • 59
  • 2
  • 15
  • Did you try running [`git lfs fetch`](https://www.mankier.com/1/git-lfs-fetch) eventually also `git lfs fetch origin --all`? – derHugo Apr 17 '19 at 15:23
  • 1
    When you use git-lfs, that's what git-lfs actually has Git store. If you take a git-lfs repository and use it with plain Git instead of with git-lfs, that's what you'll see, because that's what is in Git. The git-lfs wrappers normally hide this from you by spotting these files and replacing the one you see with the file that's stored somewhere *other* than in Git. So it looks like you've run plain Git instead of git-lfs, but perhaps there's some way to mis-configure git-lfs to cause this too. – torek Apr 17 '19 at 15:35
  • 1
    I just ran `git lfs fetch` and then `git lfs pull` and it seems to have worked! Thank you very much for that, I did not realize that lfs had a separate push and pull system. – Chris McCole Apr 17 '19 at 15:37

1 Answers1

3

These are the pointer files that Git LFS uses to track objects. The fact that you're seeing them means that the proper filters for your repository aren't set up. Run git lfs install within your checkout to install the filters both in your repository and in your ~/.gitconfig.

Once you've done that, you can run git lfs checkout to fix the current repository, and then Git LFS should work normally when you check out a branch. If you modify or replace your ~/.gitconfig file, be sure to keep the filter entries that git lfs install inserted there.

The proper commands to set the options are as follows:

git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

It's much easier to invoke git lfs install, though.

bk2204
  • 64,793
  • 6
  • 84
  • 100