---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/lfs.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/operations/lfs.md
  - href: en/sourcecraft/operations/lfs.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# Configuring a SourceCraft repository to support Git Large File Storage (LFS)

<!-- source: en/_includes/sourcecraft/lfs-description.md -->
SourceCraft repositories support [Git Large File Storage (LFS)](https://git-lfs.com/) for storing large files. We recommend using LFS for storing objects larger than 100 MB in the repository.
<!-- endsource: en/_includes/sourcecraft/lfs-description.md -->

1. Clone the SourceCraft repository:

    {% list tabs %}

    - HTTPS

      <!-- source: en/_includes/sourcecraft/clone-repo-pat.md -->
      1. [Install Git](https://git-scm.com/downloads).
      1. In the top-right corner of the repository page, click ![image](../../_assets/console-icons/chevron-down-wide.svg) **Clone**.
      1. Copy the ![image](../../_assets/console-icons/copy.svg) link for cloning the repository from the **HTTPS** field.
      1. In the terminal, run this command:

          ```bash
          git clone <link_for_cloning_repository>
          ```

      1. Enter a username.
      1. Specify the [personal token](https://sourcecraft.dev/portal/docs/en/sourcecraft/security/pat.md#create) as the password.

          {% note tip %}

          If you do not want to enter your username and password every time, use the following command:

          ```bash
          git clone https://anyname:<personal_access_token>@git.sourcecraft.dev/<organization_slug>/<repository_slug>.git
          ```

          {% endnote %}

      1. Go to your cloned repository:

         ```bash
         cd <repository_name>
         ```
      <!-- endsource: en/_includes/sourcecraft/clone-repo-pat.md -->

    - SSH

      <!-- source: en/_includes/sourcecraft/clone-repo-ssh.md -->
      1. [Install Git](https://git-scm.com/downloads).
      1. In the top-right corner of the repository page, click ![image](../../_assets/console-icons/chevron-down-wide.svg) **Clone**.
      1. Copy the ![image](../../_assets/console-icons/copy.svg) link for cloning the repository from the **SSH** field:
      1. In the terminal, run this command:
          
          ```bash
          git clone <link_for_cloning_repository>
          ```

          To clone the repository via port 443, specify the port number in the URL:

          ```bash
          git clone ssh://ssh.sourcecraft.dev:443/<organization_slug>/<repository_slug>.git
          ```

          Here is an example:

          ```bash
          git clone ssh://ssh.sourcecraft.dev:443/sourcecraft/sourcecraft.git
          ```

          For more information on using SSH over HTTPS, see [this GitHub guide](https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port).

      1. Go to your cloned repository:
          
         ```bash
         cd <repository_name>
         ```
      <!-- endsource: en/_includes/sourcecraft/clone-repo-ssh.md -->

    {% endlist %}

1. [Install](https://github.com/git-lfs/git-lfs#installing) `git-lfs`:
1. Configure your repository to support LFS:

    ```bash
    git lfs install
    ```

1. Copy the files you want to store in LFS into the repository.
1. List the files for LFS storage, separating them with spaces:

    ```bash
    git lfs track "<path_to_large_file_1>" "<path_to_large_file_2>" "<path_to_large_file_n>"
    ```

    {% note tip %}

    You can also specify file templates to store in LFS, e.g., `git lfs track "*.png"`

    {% endnote %}

1. Stage the files in Git, create a commit, and push the changes to the remote repository:

    ```bash
    git add .
    git commit -m "added LFS objects"
    git push origin main
    ```

#### Useful links {#see-also}

* [SourceCraft resource relationships](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md)
* [Importing a repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/migration.md)
* [Making a pull request](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/pr-create.md)
