Set up LFS client and work with large files

Download the Git LFS client for your platform. Instructions in this topic are valid for Git LFS client 1.3 and later. The checkout URLs are automatically extended with LFS part and you do not have to modify the checkout URL manually to have it working out of the box for SSH protocol or replication scenarios.

For downloading Git LFS client, see Git Large File Storage page.

Working with LFS over HTTP/HTTPS (without replication)

  1. Use extended checkout URL.

    Example:

    git clone -c
          'lfs.url=http://product_developer@main.server.collab.net/gerrit/test_repo.git/info/lfs'
          ssh://product_developer@gerrit.server.collab.net:29418/test_repo && cd "test_repo" && git
          config user.name "Nancy S." && git config user.email "nancy@example.com" && git config
          url."ssh://gerrit.server.collab.net:29418".insteadOf "ssh://main.server.collab.net:29418"
          && git config url."ssh://product_developer@gerrit.server.collab.net:29418".insteadOf
          "ssh://product_developer@main.server.collab.net:29418" && git config
          url."ssh://product_developer@main.server.collab.net:29418".pushInsteadOf
          "ssh://product_developer@gerrit.server.collab.net:29418" && scp -P 29418
          product_developer@gerrit.server.collab.net:hooks/commit-msg .git/hooks/
  2. Select the file types you'd like Git LFS to manage. You can configure additional file extensions anytime.

    The following command tracks all .jpg images in a given working directory.

    • git lfs track *.jpg
  3. Create a commit by adding the binary file and the technical file (.gitattributes) that is modified by Git LFS client.
    • git add IMG_0036.jpg .gitattributes
  4. Commit and push the file(s) to the remote repository.
    • git commit -sm 'This is LFS test' && git push origin HEAD:master
    The binary file that is successfully pushed to LFS manifests itself by having a reference file committed to Gerrit and you can check its content by going to TeamForge code browser for the given repository. Here is an example reference file. It contains Git LFS protocol version specification along with Git LFS object SHA and its size.