16

When using Git LFS to push large files to git repository, can a user which does not have git-lfs installed on its system clone it without any additional setup?

Pedro Lopes
  • 2,833
  • 1
  • 30
  • 36
  • 2
    I suspect they can, but the large files will contain references, not the content. Try it and see? – Schwern Sep 25 '16 at 23:13
  • a related question resulted in an answer that might be relevant here too: https://stackoverflow.com/a/48051013/3156685 – davidovitch Feb 27 '19 at 14:29

3 Answers3

9

I just tried to do what you suggested. I created a repository that stores .csv files using Git LFS. I pushed the repo to GitHub. Then, on a system that doesn't have Git LFS installed, I tried to clone the repo and received an error saying that the "git lfs" command was not found:

λ git clone https://github.com/myusername/git_lfs_tests.git
Cloning into 'git_lfs_tests'...
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 11 (delta 2), reused 10 (delta 1), pack-reused 0
Unpacking objects: 100% (11/11), done.
git-lfs filter-process: git-lfs: command not found
fatal: The remote end hung up unexpectedly
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Once I installed Git LFS, it worked just fine. So, it appears that you need git lfs on the system to clone the repo.

jmbejara
  • 256
  • 6
  • 12
  • 2
    I'm not sure this is quite correct... how did you uninstall `git-lfs`? Did you just remove the binary from your PATH, or did you also run `git lfs uninstall` first and/or remove the lfs entries from your ~/.gitconfig? If you didn't do the latter, the error you got is a result of the lfs entries staying in your ~/.gitconfig. Without those, I'm pretty sure the clone would just silently fail (fetching the LFS placeholder objects instead of the actual files). – alecbz Aug 31 '18 at 15:42
  • I installed git-lfs `sudo apt-get install git-lfs` – dazza5000 Aug 15 '19 at 03:48
  • your print off says "Clone succeeded". it works, you just don't get any lfs files. you get a place holder that points to where they the repo. – travelingbones Dec 23 '22 at 19:19
7

you can definitely clone an lfs repo without lfs installed. in fact, git lfs clone is now deprecated. lfs really only matters when you checkout, not when you clone. if you checkout without lfs (which could happen during a clone), you will get placeholder files containing references instead of the real large files.

Lanchon
  • 343
  • 3
  • 7
  • Adding on: to replace the placeholder (git lfs tracked) files, (1) install git lfs (2) delete any placeholder files (3) run `git checkout .` and it will download them. See: https://github.com/git-lfs/git-lfs/issues/325 – travelingbones Dec 23 '22 at 19:28
0

If downloading repo as .zip file is okay for you, here is a possible suggestion. It ended up working for me for to download a heavy project, while using a free Github account:

  1. Fork the repo to one of your users Go to repo settings
  2. Find "Include Git LFS objects in archives" under the Archives section and check it
  3. Go to the Danger Zone section, select "Archive this repository"
  4. Confirm and authorize.
  5. Return to the archived repository.
  6. Download as .zip
  7. Download will pause for a minute or so before it starts downloading lfs objects. Wait and it should continue.

Credits to a Git user from here:
(https://github.com/nabla-c0d3/nassl/issues/17#issuecomment-804149931)

San Askaruly
  • 311
  • 1
  • 10