Skip to main content

Git LFS Repositories

Git Large File Storage (LFS) is a Git extension mechanism to store large files outside of the Git repository while still accessing them as if they were part of the same project. A pointer file replaces the file inside of the Git repository, while the file is archived in the Nexus Repository. Nexus Repository supports the batch API, the basic transfer adapter for uploading and downloading files, and a hosted repository for storing the files from the Git LFS client.

These operations are handled automatically by the Git LFS client once installed on developers' workstations and configured for use with Nexus Repository.

More information on this format can be found on the Github Git LFS.

  • Requires Git 1.8.2 or above

  • Git LFS versions 1.* and 2.* are supported

Create a Hosted Git LFS Repository

To host Git LFS content in Nexus Repository Manager, create a new gitlfs (hosted) repository.

Minimal configuration steps are:

  • Define Name

  • Select a Blob store for Storage

    We recommend using a custom blob store for Git LFS repositories.

Removing content from a Git LFS repository is not recommended and no cleanup task exists. Removing files from Git LFS means that those files will no longer be available from your associated Git repository, and the pointer files in Git will point to content that no longer exists.

The Strict Content Type Validation option does not apply to Git LFS repositories. Since Git LFS by its nature accepts any kind of file content, we perform no content validation on incoming files and assume all files are generic application/octet-stream content.

Take care to document your configuration when mapping the Git-LFS repositories and your Git projects. The origin of a particular file is not provided to a Git LFS repository and is only stored in the Git repository.

Consider limiting hosted repositories to a single Git project to separate environments.

Installing Git LFS

Download and install Git LFS on your local machine. Follow the installation directions for Git LFS for your particular platform. After installation, run the following command to confirm that the installation succeeded.

git lfs env

Configuring Git LFS

Configure your local Git LFS installation to use Nexus Repository as the Git LFS backend. We recommend using the Git LFS Tutorial.

  1. To configure a Git project to use with Git LFS, use the Git command line tool to configure your .lfsconfig file:

    git config -f .lfsconfig lfs.url http://localhost:8081/repository/gitlfs-hosted/info/lfs
  2. Configure Git LFS with which files to store in the repository using the following command to modify the .gitattributes file:

    git lfs track '*.jpg' 

    Do not track your configuration files. Git LFS may appear to work but does not send or retrieve files from Nexus Repository.

  3. Commit and push the .lfsconfig and .gitattributes filew to your Git project.