Skip to content
Chris Darroch edited this page Dec 6, 2024 · 29 revisions

Requirements

  • git >= 2.0.0

Installing

On all operating systems, once Git LFS is downloaded, git lfs install must be run. Each user that intends to use Git LFS must run this command, but they only ever need to run it once. Git LFS can be disabled by running git lfs uninstall, in which case that user would have to run git lfs install again, before Git LFS features work again.

Some users may wish to only enable Git LFS on specific repositories instead of always having it on for all of the repositories. Instead of running git lfs install and enabling Git LFS for that entire user, git lfs install --local can be used instead on a per repository basis.

Note: If Git LFS is installed without --local, then git lfs uninstall --local would not disable it for a specific repository.

An additional option of --skip-smudge can be added to skip automatic downloading of objects on clone or pull. This requires a manual git lfs pull every time a new commit is checked out on your repository. This is more useful for cases where you don't always want to download/checkout every large file.

Debian and Ubuntu

Ubuntu 18.04, Debian 10, and newer versions of those OSes offer a git-lfs package. If you'd like to use that and don't need the latest version, skip step 1 below.

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

macOS

Git LFS is offered as a Homebrew formula which may be installed using the brew command:

  1. Run brew update to get all the new formulas
  2. brew install git-lfs
  3. git lfs install

RHEL/CentOS

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

Windows

If you are using Git for Windows (https://gitforwindows.org), then Git LFS is offered as an option when installing that project. We recommend using Git for Windows as it provides a comprehensive Git environment for Windows.

If you are using Chocolatey, then Git LFS may be installed with the choco install git-lfs.install command.

To install Git LFS independently, you can use the Windows Installer package provided with each Git LFS release:

  1. Download the Windows Installer from the list of assets for the most recent Git LFS release
  2. Run the Windows Installer, which will be named git-lfs-windows-v*.exe
  3. Start a command interpreter and run git lfs install

Docker Recipes

For Debian Distros, you can use

RUN build_deps="curl" && \
    apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${build_deps} ca-certificates && \
    curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git-lfs && \
    git lfs install && \
    DEBIAN_FRONTEND=noninteractive apt-get purge -y --auto-remove ${build_deps} && \
    rm -r /var/lib/apt/lists/*

Manual Installation

To install on any supported operating system, you can manually install Git LFS.

Only one file is required, the git-lfs binary. Pre-compiled binaries for multiple platforms are available for each Git LFS release, including for FreeBSD, Linux, macOS, and Windows.

Download the appropriate package, unpack it, and place the git-lfs binary (git-lfs.exe for Windows) in a location listed in your system's PATH environment variable.

Source

Building requires a standard Unix environment with GNU make and Bash. On Windows, you should install GNU make (e.g., via Chocolatey) and build under Git Bash.

  1. Ensure that you have a reasonably modern version of Go.
  2. If you are using Windows, build goversioninfo (e.g., with go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo) and place the binary in your PATH.
  3. Obtain a copy of the repository with git clone (into the appropriate location within your $GOPATH).
  4. In your copy of the source, execute make to ensure that you are able to build a fresh copy of Git LFS. If successful, the binary will appear in bin/git-lfs.
Clone this wiki locally