How to fix git: 'lfs' is not a git command. See 'git --help'. in Git

GitBEGINNERMEDIUMUpdated Dec 6, 2025Β· 334 views

This error occurs when Git Large File Storage (LFS) is not installed on your system. Git LFS is a separate extension that must be installed and initialized before you can use git lfs commands.

Quick fix

Fixes git: 'lfs' is not a git command. See 'git --help'.

brew install git-lfs
  1. Install Git LFS on macOS using Homebrew
  2. Install Git LFS on Ubuntu/Debian
  3. Install Git LFS on Windows
  4. Install Git LFS on CentOS/RHEL/Fedora
git β€” error
brew install git-lfs
git: 'lfs' is not a git command. See 'git --help'.

What this error means

Git Large File Storage (LFS) is an extension to Git that replaces large files (such as audio samples, videos, datasets, and graphics) with text pointers inside Git, while storing the actual file contents on a remote server. This allows repositories to stay lightweight while still tracking large files. When you see "git: 'lfs' is not a git command," it means Git cannot find the `git-lfs` executable in your system PATH. Unlike core Git commands like `commit` or `push`, Git LFS is not bundled with Gitβ€”it must be installed separately. This error commonly appears when cloning a repository that uses Git LFS for large files, when your CI/CD pipeline encounters LFS-tracked files, or when you try to track new large files with `git lfs track`. Without Git LFS installed, Git will not be able to download the actual contents of LFS-tracked files, leaving you with small pointer files instead.

Typical symptoms

  • Running any git lfs command shows 'lfs is not a git command'
  • Cloned repository contains small text pointer files instead of actual large files
  • git lfs install fails with command not found
  • CI/CD pipeline fails when encountering LFS-tracked files
  • Error message suggests running 'git --help' to see available commands

Common causes

  1. Git LFS is not installed on your system (most common)
  2. Git LFS was installed but the git-lfs binary is not in your PATH
  3. On macOS: conflict between Xcode's bundled Git and Homebrew-installed Git LFS
  4. Git LFS installation was interrupted or incomplete
  5. Using a minimal Git installation that doesn't include LFS (common in containers)
  6. PATH environment variable not updated after installation (requires terminal restart)

How to fix "git: 'lfs' is not a git command. See 'git --help'."

1Install Git LFS on macOS using Homebrew

The recommended way to install Git LFS on macOS is via Homebrew:

bash
brew install git-lfs

After installation, initialize Git LFS:

bash
git lfs install

Note: If you're using the Xcode-provided Git but Homebrew-installed git-lfs, you may need to create a symlink (see Advanced Notes).

2Install Git LFS on Ubuntu/Debian

On modern Ubuntu (21.04+) and Debian systems, install directly from the package manager:

bash
sudo apt update
sudo apt install git-lfs

For the latest version, use the PackageCloud repository:

bash
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs

Then initialize:

bash
git lfs install
3Install Git LFS on Windows

Option 1: Using winget (Windows 10/11)

powershell
winget install -e --id GitHub.GitLFS

Option 2: Using Chocolatey

powershell
choco install git-lfs.install

Option 3: Reinstall Git for Windows

If you have Git for Windows installed, you can reinstall it and select "Git LFS (Large File Support)" in the "Select Components" step of the installer.

After installation, open a new terminal and run:

bash
git lfs install

Important: Close and reopen your terminal after installation for PATH changes to take effect.

4Install Git LFS on CentOS/RHEL/Fedora

For Fedora:

bash
sudo dnf install git-lfs

For CentOS/RHEL, first add the PackageCloud repository:

bash
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
sudo yum install git-lfs

Then initialize:

bash
git lfs install
5Verify the installation

After installing, verify Git LFS is working:

bash
git lfs version

You should see output like:

bash
git-lfs/3.6.0 (GitHub; linux amd64; go 1.21.3)

Also verify the install hook was set up:

bash
git lfs install

Expected output:

bash
Git LFS initialized.
6Fix PATH issues (if LFS is installed but not found)

If Git LFS is installed but Git still can't find it, the git-lfs binary may not be in your PATH.

Find where git-lfs is installed:

bash
which git-lfs
# or on Windows:
where git-lfs

Add to PATH (Linux/macOS):

Add the following to your shell configuration file (~/.bashrc, ~/.zshrc, or ~/.bash_profile):

bash
export PATH="/usr/local/bin:$PATH"
# or for Homebrew on Apple Silicon:
export PATH="/opt/homebrew/bin:$PATH"

Then reload your shell configuration:

bash
source ~/.bashrc  # or ~/.zshrc
7Pull LFS files in existing repository

If you cloned a repository before installing Git LFS, you'll have pointer files instead of actual content. After installing Git LFS, fetch the real files:

bash
git lfs pull

Or to fetch LFS files for a specific pattern:

bash
git lfs pull --include="*.psd"

To re-checkout all LFS files:

bash
git lfs checkout

Advanced notes

### macOS: Xcode Git vs Homebrew Git LFS Conflict

A common issue on macOS occurs when you're using the Git bundled with Xcode Command Line Tools, but Git LFS was installed via Homebrew. The two may not be aware of each other.

Solution: Create a symlink

bash
ln -s "$(which git-lfs)" "$(git --exec-path)/git-lfs"

This places the git-lfs binary in the directory where your Git installation looks for subcommands.

Alternative: Use Homebrew's Git

Install and use Homebrew's Git instead of Xcode's:

bash
brew install git

Ensure Homebrew's bin directory is first in your PATH.

### Docker and CI/CD Environments

Many minimal container images don't include Git LFS. Add it to your Dockerfile:

Debian/Ubuntu-based images:

dockerfile
RUN apt-get update && apt-get install -y git-lfs && git lfs install

Alpine-based images:

dockerfile
RUN apk add --no-cache git-lfs && git lfs install

### Per-Repository vs Global Installation

Running git lfs install configures Git LFS globally for your user. To enable it only for specific repositories:

bash
git lfs install --local

This adds the LFS hooks only to the current repository's Git configuration.

### Checking LFS Tracked Files

To see what files are being tracked by LFS in a repository:

bash
git lfs ls-files

To see what patterns are configured for LFS tracking:

bash
cat .gitattributes | grep filter=lfs

Frequently asked questions

What does "git: 'lfs' is not a git command. See 'git --help'." mean?
Git Large File Storage (LFS) is an extension to Git that replaces large files (such as audio samples, videos, datasets, and graphics) with text pointers inside Git, while storing the actual file contents on a remote server. This allows repositories to stay lightweight while still tracking large files. When you see "git: 'lfs' is not a git command," it means Git cannot find the git-lfs executable in your system PATH.
How do I fix "git: 'lfs' is not a git command. See 'git --help'."?
This error occurs when Git Large File Storage (LFS) is not installed on your system. Git LFS is a separate extension that must be installed and initialized before you can use git lfs commands.
What causes "git: 'lfs' is not a git command. See 'git --help'."?
Git LFS is not installed on your system (most common) Git LFS was installed but the git-lfs binary is not in your PATH On macOS: conflict between Xcode's bundled Git and Homebrew-installed Git LFS
Is the "git: 'lfs' is not a git command. See 'git --help'." error serious?
It is a medium-severity error β€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading