Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve original files after a git clone with git lfs

Tags:

git

git-lfs

I am a bit confused. I back up a project with Github.com. Because my files are too large to store them on Github.com, I am using git large file storage. Now I changed to a new computer, and performed a git clone on the repository stored remotly on Github.com. I also installed git lfs with brew and did a git lfs install in the just cloned repository. However, my large files are still "pointer files". When I run my project,it says, these files are missing.

I did a

git lfs fetch --all

which downloaded something. But where is it? How do I retrieve the files I backed up with git lfs after moving to a completly new computer with a fresh setup?

like image 534
Stophface Avatar asked Mar 09 '26 06:03

Stophface


1 Answers

Run the following commands:

# Fetch all the LFS files from the remote
git lfs fetch

# Replace the pointer files to the actual files
git lfs checkout

Now you should see that the pointer files are replaced by the original files.


Moderator notes: You need Git LFS extension installed on your system for these commands to work. Official site: https://git-lfs.com/

Install command for ubuntu/debian/linux-mint:

sudo apt-get install git-lfs

In absence of this, you might see an error message like: git: 'lfs' is not a git command. See 'git --help'.. As LFS is not a built-in extension in git.

like image 90
Stophface Avatar answered Mar 11 '26 06:03

Stophface



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!