> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-integration/use-harness-ci/use-harness-ci/codebase-configuration/static/gitlfs.md).

# Git Large File Storage

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

The [Git Large File Storage (LFS)](https://git-lfs.com/) 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 commands.

### Git LFS requirements <a href="#git-lfs-requirements" id="git-lfs-requirements"></a>

* You are familiar with Git LFS and you have already configured your repos for LFS.
* You have a [CI pipeline](/continuous-integration/use-harness-ci/use-harness-ci/prep-ci-pipeline-components.md) with a [Build stage](/continuous-integration/use-harness-ci/use-harness-ci/set-up-build-infrastructure/ci-stage-settings.md).

### Install the Git LFS client <a href="#install-the-git-lfs-client" id="install-the-git-lfs-client"></a>

You can 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, skip to [Run git lfs commands](#run-git-lfs-commands).

With Harness Cloud build infrastructure, a version of Git LFS is already installed on Harness Cloud runners. For Harness Cloud image specs, go to [Use Harness Cloud build infrastructure](/continuous-integration/use-harness-ci/use-harness-ci/set-up-build-infrastructure/use-harness-cloud-build-infrastructure.md). You can use a **Run** step to install a different version of the Git LFS client if you do not want to use the pre-installed version. Otherwise, skip to [Run git lfs commands](#run-git-lfs-commands).

{% tabs %}
{% tab title="Visual" %}

1. In your pipeline's **Build** stage, add a **Run** step.
2. Enter a **Name** and optional **Description**.
3. Depending on the build infrastructure, you might need to specify a **Container Registry** connector, such as a Docker connector, and an **Image**, such as `curlimages/curl:latest`. For information about when these settings are required and how to specify images, go to [Use Run steps](/continuous-integration/use-harness-ci/use-harness-ci/run-step-settings.md).
4. For **Shell**, select **Sh**.
5. In the **Command** field, enter commands to get the [Git LFS Package Cloud repo](https://packagecloud.io/github/git-lfs) and install the package for your platform. For example, these commands install Git LFS 3.3.0 on Debian:

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

   For information about these commands, select **Install** next to the relevant package on the [Git LFS Package Cloud repo](https://packagecloud.io/github/git-lfs), or go to the Git LFS documentation on [Installing Git LFS](https://github.com/git-lfs/git-lfs#installing).
6. Select **Apply Changes** to save the step, and then select **Save** to save the pipeline.
   {% endtab %}

{% tab title="YAML" %}
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, you might need to specify a `connectorRef`, such as a Docker connector, and an `image`, such as `curlimages/curl:7.73.0`. For information about when these settings are required and how to specify images, go to [Use Run steps](/continuous-integration/use-harness-ci/use-harness-ci/run-step-settings.md).
* `shell: Sh`
* `command`: Enter commands to get the [Git LFS Package Cloud repo](https://packagecloud.io/github/git-lfs) 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](https://packagecloud.io/github/git-lfs), or go to the Git LFS documentation on [Installing Git LFS](https://github.com/git-lfs/git-lfs#installing).

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

```yaml
              - step:
                  type: Run
                  name: install gitlfs
                  identifier: install_gitlfs
                  spec:
                    connectorRef: account.harnessImage ## Specify a container registry connector, if required.
                    image: curlimages/curl:latest ## Specify an image, if required.
                    shell: Sh
                    command: |- ## Use commands for your platform.
                      curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
                      sudo apt-get install git-lfs=3.3.0
```

{% endtab %}
{% endtabs %}

### Run git lfs commands <a href="#run-git-lfs-commands" id="run-git-lfs-commands"></a>

These examples show how to use a **Run** step to run `git lfs clone`.

`git lfs clone` commands are formatted as `git lfs clone [git clone options] <repository> [<directory>]`. It supports the same options as `git clone`.

For more information about `git lfs` commands, including `git lfs clone`, go to the [Git LFS documentation](https://github.com/git-lfs/git-lfs/tree/main/docs).

{% tabs %}
{% tab title="Visual" %}

1. In your pipeline's **Build** stage, add a **Run** step.
2. Enter a **Name** and optional **Description**.
3. Depending on the build infrastructure, you might need to specify a **Container Registry** connector, such as a Docker connector, and an **Image**, such as `alpine:latest`. For information about when these settings are required and how to specify images, go to [Use Run steps](/continuous-integration/use-harness-ci/use-harness-ci/run-step-settings.md).
4. For **Shell**, select **Sh**.
5. In the **Command** field, enter your `git lfs` command as you would on the command line.

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

   For information about these commands, select **Install** next to the relevant package on the [Git LFS Package Cloud repo](https://packagecloud.io/github/git-lfs), or go to the Git LFS documentation on [Installing Git LFS](https://github.com/git-lfs/git-lfs#installing).
6. Select **Apply Changes** to save the step, and then select **Save** to save the pipeline.
   {% endtab %}

{% tab title="YAML" %}
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, you might need to specify a `connectorRef`, such as a Docker connector, and an `image`, such as `alpine:latest`. For information about when these settings are required and how to specify images, go to [Use Run steps](/continuous-integration/use-harness-ci/use-harness-ci/run-step-settings.md).
* `shell: Sh`
* `command`: Enter your `git lfs` command as you would on the command line.

For example, this step runs `git lfs clone`. The `connectorRef` and `image` are omitted because they are not required by the build infrastructure.

```yaml
              - step:
                  type: Run
                  name: git lfs clone
                  identifier: git_lfs_clone
                  spec:
                    shell: Sh
                    command: |-
                      git lfs clone harness/developer-hub
```

{% endtab %}
{% endtabs %}

### Git LFS logs <a href="#git-lfs-logs" id="git-lfs-logs"></a>

Save and run your pipeline. While the build runs, you can observe the step logs on the [Build details page](/continuous-integration/use-harness-ci/use-harness-ci/viewing-builds.md).

{% @harness-feedback/feedback %}
