VSTS git LFS . Repository / Checkout files from LFS . , .
Pascal git Remote Access, . git -lfs.exe , LFS .
. Allow Scripts to Access OAuth Token . PowerShell script, LFS:
function Set-UnixLineEndings([string]$file)
{
$text = [IO.File]::ReadAllText($file) -replace "`r`n", "`n"
[IO.File]::WriteAllText($file, $text)
$text = [IO.File]::ReadAllText($file) -replace "`r", "`n"
[IO.File]::WriteAllText($file, $text)
}
if ((Test-Path env:SYSTEM_ACCESSTOKEN) -eq $false)
{
throw "OAuth token not available. Make sure that you select the option 'Allow Scripts to Access OAuth Token' in build 'Options' pane."
}
$pwPath = Join-Path $PSScriptRoot pw.txt
$gitPwPath = $pwPath.Replace('\', '/')
$repoUri = New-Object Uri $env:BUILD_REPOSITORY_URI
git config credential.helper "store --file=$gitPwPath"
@"
https://OAuth:$env:SYSTEM_ACCESSTOKEN@$($repoUri.Host)
"@ | Set-Content $pwPath
Set-UnixLineEndings -file $pwPath
& ".\git-lfs.exe" pull
if ($LASTEXITCODE -ne 0)
{
throw 'Failed to pull LFS files.'
}
, , , git -lfs.exe git LFS.