Is it possible to locally cache ALL files in a git-LFS repo for offline use? That is, make the repo usable like a normal git repo, even without an internet connection to fetch git-LFS files?
            Asked
            
        
        
            Active
            
        
            Viewed 6.0k times
        
    50
            
            
        - 
                    1Here is a related Q&A I just posted: [What is the difference between `git lfs fetch`, `git lfs fetch --all`, and `git lfs pull`?](https://stackoverflow.com/q/72610494/4561887) – Gabriel Staples Jun 14 '22 at 01:13
2 Answers
68
            
            
        Yes! You can download all LFS files with the following command:
git lfs fetch --all
Check out the documentation for this feature here:
https://github.com/git-lfs/git-lfs/blob/master/docs/man/git-lfs-fetch.1.ronn
 
    
    
        mbaker3
        
- 895
- 6
- 9
- 
                    9I'd add a caution: this retrieves all copies of the lfs-stored binaries (all historical versions, reached on any branch), not just the ones you need right now (the --all flag could bring in a lot more than you really intend). I just want current binaries to use while in the cave, not historical, and I'm limiting my download to a branch like `git lfs fetch origin master`. – pauljohn32 Sep 18 '20 at 16:27
- 
                    7That should be the default behaviour of LFS. In fact `git fetch origin master` should accomplish what you want if LFS is behaving correctly. The original question wanted ALL files cached so they could use the the repo like a normal git repo. In that situation you do need all historical versions of binaries. – mbaker3 Sep 19 '20 at 18:23
8
            
            
        Local git to retrieve the latest meta-data
git lfs fetch --all
Brings (copy) the changes from the remote repository
git lfs pull
 
    
    
        joydeba
        
- 778
- 1
- 9
- 24
- 
                    4I was really struggling to understand what `git lfs fetch` does, vs `git lfs fetch --all`, `git lfs pull`, and `git lfs checkout`, as they were super confusing, so I just did the study & posted this Q&A: [What is the difference between `git lfs fetch`, `git lfs fetch --all`, `git lfs pull`, and `git lfs checkout`?](https://stackoverflow.com/a/72610495/4561887). – Gabriel Staples Jun 14 '22 at 01:15
 
    