How to use Git LFS with Azure Repos and Pipelines


I have a project using Git LFS in Azure Repos with several binary image files being checked in using Git LFS. When my Azure Pipelines build performs a git pull, the image files are not pulled from Git LFS and I am left with several zero byte image files.

I’m using a custom self-hosted Azure Pipelines build server which has a recent version of Git LFS installed on it:

PS C:\rehan> git lfs --version                                                                                     git-lfs/2.7.2 (GitHub; windows amd64; go 1.12.2; git 08a08ae0)

I’ve tried adding steps to perform a git lfs install but that doesn’t help. When I manually perform a git lfs pull after logging on to the build server, the files are downloaded correctly. When I run git lfs pull as a build step in my Azure Pipeline, I get the following error:

fatal: could not read Username for '': terminal prompts disabled
batch response: Git credentials for not found.
error: failed to fetch some objects from ''
Downloading LFS objects:   0% (0/1), 0 B | 0 B/s                                
##[error]PowerShell exited with code '1'.


You have to use https for lfs to work with Azure Devops and you have to do LFS checkout when doing the builds:

- checkout: self  # self represents the repo where the initial Pipelines YAML file was found
  lfs: true

if you are using a UI wizard there is a checkbox to checkout lfs

Answered By – 4c74356b41

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published