How to checkout Git LFS files?

I was trying out Glitch with my git project, but I ran into a problem that after the git clone my workspace doesn’t have the Git Large File Extension (LFS) installed. Is there a way to checkout my Git LFS files?

My project https://glitch.com/~darthwalsh-austerity looks like this (Click New Game, click ? Help):
image

All my image files show up broken, because LFS isn’t installed and the images files are just text pointers:

$ cat client/cards/Bank.jpg
version https://git-lfs.github.com/spec/v1
oid sha256:2674ca480c4582b59fc67e7489da8aa1bd681ec86767ecc0f7d822656815044c
size 23724

Manually trying to checkout LFS files shows LFS isn’t installed.

$ git lfs fetch
git: 'lfs' is not a git command. See 'git --help'.

Did you mean this?
        log

I was being optimistic and tried to manually install git-lfs, but I didn’t expect this to work:

$ apt-get install git-lfs
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Does Glitch support Git LFS files?

As a workaround I could manually download the files to my glitch file system, or stop using Git LFS in my projects, but neither of these seem like great options.

Hi @darthwalsh, welcome to the Glitch forum!

You’re correct that Glitch’s git install does not support git lfs out of the box. Based on my relatively novice understanding of lfs I’m not sure I see it as something widely useful in Glitch projects, since they’re relatively limited as far as disk space is concerned, but I’m sure there may be some use cases that could make it useful even when the total git repo size including large files is under ~185Mb (the point at which Glitch projects begin to misbehave).

Fortunately you can install git-lfs from binaries without too much difficulty and only taking about 14Mb of space in your project as follows:

  1. mkdir src
  2. wget https://github.com/git-lfs/git-lfs/releases/download/v2.8.0/git-lfs-linux-amd64-v2.8.0.tar.gz -O /app/src/git-lfs.tar.gz (get the appropriate url for the binaries form https://github.com/git-lfs/git-lfs/releases. look for the Linux AMD64 versions)
  3. cd src
  4. tar -xzvf git-lfs.tar.gz
  5. export PREFIX="/app"
  6. ./install.sh
  7. cd ..
  8. rm -rf src

After step 6 you should see something like

Updated git hooks.
Git LFS initialized.

Hope this helps!

1 Like