Git-LFS setup in Jenkins

Priya Talreja
2 min readAug 7, 2019

--

Git LFS (Large File Storage) is a Git extension that reduces the impact of large files in your repository by downloading the relevant versions of them lazily. Specifically, large files are downloaded during the checkout process rather than during cloning or fetching.

  1. Pre SCM BuildStep” Plugin in Jenkins.
  • On the Jenkins dashboard, click on Manage Jenkins and select Manage Plugins. Click on the Available tab.
  • Search for Pre SCM BuildStep and Install.

2. Setup Git LFS

  • In Job Configuration, Select the property Run buildstep before SCM runs in Build Environment Section and Click on Add Build Step, Select Execute Shell.
    Add below command in the shell,
git lfs install

3. Configure Git and LFS pull in the Source Code Management section.

  • Enter the Repository URL and credentials
  • Enter the Branch name for which build needs to be created.
  • In Additional Behaviours, Add Git LFS pull after checkout.

Save and Build the Job. Once the build has succeeded, Verify if LFS files are cloned in the workspace directory.

Thank you. Hope this helps you. Please let me know if you have any queries.

--

--