Pascal Berger Pascal Berger - 1 month ago 26
Git Question

Check out git-lfs files on VSTF build

I've a repository hosted on VSTS, containig a file stored through git-lfs. If I just let VSTS build checkout the repository it just downloads the git-lfs metadata file containing the ID of the file.

Here's the output how VSTS gets its source:

Syncing repository: MyRepo (Git)
Checking out c84ef2f2bbad4fa3dc70dbd4100534390b9c8f18 to d:\work\73\s
Checked out branch refs/heads/develop for repository MyRepo at commit c84ef2f2bbad4fa3dc70dbd4100534390b9c8f18


What do I need to do to checkout the real file?

Edit: I assume I need to manually call
git lfs fetch
after VSTS checked out the source. But how can I handle authentication (which is required by VSTS) in this case?

Answer

VSTS has now an Allow Scripts to Access OAuth Token option. With this option set on the build definition the OAuth is available to build scripts.

I've created an extension containing build tasks which change the remote Url to use the OAuth token to access the remote repository.