Check out git-lfs files on VSTF build

后端 未结 5 1020
迷失自我
迷失自我 2021-01-03 08:56

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 cont

5条回答
  •  误落风尘
    2021-01-03 09:03

    For TFS Build 2015 Update 4 (the self-hosted flavor of this thing, as opposed to VSTS, the cloud service), the "Checkout files from LFS" option does not exist, and as such, we had to do this:

    • Check Allow Scripts to Access OAuth Token on the Options tab.
    • Commit this batch file into the repository somewhere:

      REM This script is intended to fetch large (LFS) files during the TFS Build process.
      
      REM Solution derived from https://github.com/Microsoft/vsts-agent/issues/1134
      
      git config --unset-all http.extraheader
      git config --add http.extraheader "AUTHORIZATION: bearer %SYSTEM_ACCESSTOKEN%"
      git lfs fetch
      git lfs checkout
      git config --unset http.extraheader        
      
    • Add a build step of a Batch Script, and run the above script.

提交回复
热议问题