lfs install
- Git course
- Expert
- Lesson 10/32
- 4 min
Learn to set up with git lfs install.
Setup with git lfs install
Before using Git LFS in an environment, run the git lfs install command once. This command registers custom LFS filters (smudge and clean) and hook mechanisms into your Git configuration. Without this installation, Git will treat large files as normal repository objects.
# Install LFS filters and hooks:
git lfs installAfter installation, Git automatically recognizes files configured for LFS.
Clean and smudge filters
LFS filters transparently manage file operations in the background. The clean filter runs during git add to cache the large file and place the pointer in the staging area. The smudge filter runs during git checkout to read the pointer and restore the actual large file.
# Install only in current repository:
git lfs install --localThis two-way conversion lets developers work seamlessly using standard Git workflows.
Practice Configure LFS clean filter
Add git config filter.lfs.clean "git-lfs clean -- %f" to Git config and print it with git config --get filter.lfs.clean.
Starter code
git init -q -b main
# filter.lfs.clean filtresini git-lfs clean -- %f olarak ayarla
# ayari ekrana yazdirSample solution
git init -q -b main
git config filter.lfs.clean "git-lfs clean -- %f"
git config --get filter.lfs.cleanExpected output
git-lfs clean -- %f
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What is the primary operation performed by git lfs install?
- Deleting all commit history to create a single commit
- Cloning all remote repositories to the local disk
- Automatically deleting all .git folders on the machine
- Installing LFS filters and hooks into the Git configuration Correct answer
Explanation: git lfs install configures the LFS hook mechanism by registering smudge and clean filters with Git.
2 Install LFS filters and hooks
git lfs ____
git lfs install
Explanation: The git lfs install command registers the required LFS smudge and clean hooks with Git.
3 Installation and filters
| Term | Meaning |
|---|---|
git lfs install |
Installs LFS hooks and filters |
Clean filtresi |
Converts to pointer at commit time |
Smudge filtresi |
Restores actual file on checkout |
--local |
Limits installation to this repo |