Cloning Large Files with Git LFS
Git LFS (Large File Storage) is an extension for Git designed to manage large files. It stores large files in a separate location and keeps references to these files in the Git repository, preventing the repository from becoming too large. Below are the detailed steps for using Git LFS to manage and clone large files.
If the repository you need to clone contains large files managed by LFS, you can use the following method.
Install Git and Git LFS
Install Git:
sudo apt install git
Install Git LFS:
sudo apt install git-lfs
Clone the Repository
# Clone the repository you need
GIT_LFS_SKIP_SMUDGE=1 git clone <url of repo>
# Enter the cloned repository
cd <repository-folder>
GIT_LFS_SKIP_SMUDGE=1 means only cloning non-LFS files completely, while LFS files are cloned as hooks only.
Clone Large Files Using LFS
Before using Git LFS, you need to install it first. You can install Git LFS with the following command:
(This step must be performed inside the cloned directory)
git lfs install
This initializes Git LFS and enables LFS support for your Git configuration.
git lfs pull
This will pull down the large files in the repository.
Example
# Clone the repository
git clone https://github.com/yourusername/your-repo.git
cd your-repo
# Install Git LFS
git lfs install
# Pull LFS files
git lfs pull