For the complete documentation index, see llms.txt. This page is also available as Markdown.

Git Large File Storage

Use Run steps to install Git LFS and run git lfs commands in Harness CI.

The Git Large File Storage (LFS) client is an extension for versioning large files, such as audio, video, datasets, and graphics. To run git lfs commands, such as git lfs clone, in Harness CI, use Run steps to install the Git LFS client and run the commands.

What you will learn in this topic

By the end of this topic, you will learn how to:

  • Install the Git LFS client in a Run step.

  • Run git lfs commands, such as git lfs clone, in a Run step.

  • View Git LFS logs for a pipeline run.

Before you begin

Before you use Run step to install Git LFS, make sure you have:

  • Familiarity with Git LFS and repositories that you already configured for LFS.

Install the Git LFS client

Use a Run step to install the Git LFS client into the build workspace.

  • With self-managed build infrastructures, if the client is already installed on your host machine, go to Run git lfs commands.

  • With Harness Cloud build infrastructure, Harness Cloud runners already include a version of Git LFS. Go to Use Harness Cloud build infrastructure for Harness Cloud image specs. To use a different version, install it with a Run step. Otherwise, go to Run git lfs commands.

  1. In your pipeline's Build stage, add a Run step.

  2. Enter a Name and an optional Description.

  3. Depending on the build infrastructure, specify a Container Registry connector, such as a Docker connector, and an Image, such as curlimages/curl:latest. Go to Use Run steps for when these settings are required and how to specify images.

  4. For Shell, select Sh.

  5. In the Command field, enter commands that get the Git LFS Package Cloud repo and install the package for your platform. For example, these commands install Git LFS 3.3.0 on Debian:

    For information about these commands, select Install next to the relevant package on the Git LFS Package Cloud repo, or go to Installing Git LFS in the Git LFS documentation.

  6. Select Apply Changes to save the step, and then select Save to save the pipeline.

In your CI stage, add a Run step with the following settings:

  • type: Run

  • name: Enter a name for the step, such as install gitlfs.

  • identifier: Enter an ID for the step, such as install_gitlfs.

  • connectorRef and image: Depending on the build infrastructure, specify a connectorRef, such as a Docker connector, and an image, such as curlimages/curl:latest. Go to Use Run steps for when these settings are required and how to specify images.

  • shell: Sh

  • command: Enter commands that get the Git LFS Package Cloud repo and install the package for your platform. For information about these commands, select Install next to the relevant package on the Git LFS Package Cloud repo, or go to Installing Git LFS in the Git LFS documentation.

For example, this step installs Git LFS 3.3.0 on Debian:

Run git lfs commands

Use a Run step to run git lfs commands, such as git lfs clone. The git lfs clone command uses the format git lfs clone [git clone options] <repository> [<directory>] and supports the same options as git clone.

Go to the Git LFS documentation for git lfs commands, including git lfs clone.

  1. In your pipeline's Build stage, add a Run step.

  2. Enter a Name and an optional Description.

  3. Depending on the build infrastructure, specify a Container Registry connector, such as a Docker connector, and an Image, such as alpine:latest. Go to Use Run steps for when these settings are required and how to specify images.

  4. For Shell, select Sh.

  5. In the Command field, enter your git lfs command as you would on the command line. For example:

  6. Select Apply Changes to save the step, and then select Save to save the pipeline.

In your CI stage, add a Run step with the following settings:

  • type: Run

  • name: Enter a name for the step, such as git lfs clone.

  • identifier: Enter an ID for the step, such as git_lfs_clone.

  • connectorRef and image: Depending on the build infrastructure, specify a connectorRef, such as a Docker connector, and an image, such as alpine:latest. Go to Use Run steps for when these settings are required and how to specify images.

  • shell: Sh

  • command: Enter your git lfs command as you would on the command line.

For example, this step runs git lfs clone. The example omits connectorRef and image because the build infrastructure does not require them.

View Git LFS logs

Save and run your pipeline. While the build runs, you can view the step logs on the Build details page.

Next steps

Last updated

Was this helpful?