GitLFS images and/or files, how do I view them? How do I download them?

Viewed 394

My colleagues have installed Git LFS on their local machines and in turn, any images that were pushed to the remote repository (GitHub) only show the urls or nothing at all. How can I view these images? When I open the image via my local repository that I have pulled from the remote repo, I get the following error message, "It appears we don't support this file format." How do I download these images? Thanks.

enter image description here

1 Answers

If someone else is using Git-LFS, you too are forced to use Git-LFS to get the files. The reason for this is that Git-LFS (which is not Git, it's an add-on) works by a simple method:

  • You annotate particular files as being "large" or "unsuitable for Git" (in any way you and/or Git-LFS like).
  • From then on, when you run git add on one of these files, Git-LFS sneaks in and "steals" the file. It puts the file itself outside of Git's reach, and installs in its place a "pointer file". Git sees the pointer file and thinks that this is the real file.
  • When you run git commit, Git has never seen the real file, only the pointer file. Git commits the pointer file.
  • When you run git push, LFS sneaks in and first sends the real files to some server that's not a Git server, but rather a Git-LFS server. Then it lets Git push the fake files to the Git server.

The end result is that anyone who uses Git (instead of Git-LFS) gets the "fake" files—the pointer files—instead of the real files. To get the real files, you must install Git-LFS, which knows that when one of the fake files comes out of Git, Git-LFS should sneakily fetch the real file and put that in where you can see it. Git will never see the real file.

Related