如何将Git LFS与Azure Repos和管道一起使用 [英] How to use Git LFS with Azure Repos and Pipelines

查看:7
本文介绍了如何将Git LFS与Azure Repos和管道一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Azure Repos中使用Git LFS的项目,其中有几个使用Git LFS签入的二进制图像文件。当我的Azure管道构建执行git pull时,图像文件不会从Git LFS中拉出,我只剩下几个零字节的图像文件。

我使用的是一个自托管Azure管道生成服务器,该服务器上安装了最新版本的Git LFS:

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

我尝试添加步骤以执行git lfs install,但无济于事。当我在登录到构建服务器后手动执行git lfs pull时,文件被正确下载。当我在Azure管道中运行git lfs pull作为生成步骤时,我收到以下错误:

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

推荐答案

您必须使用HTTPS for LFS才能使用Azure DevOps,并且在执行构建时必须执行LFS签出:

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

如果您使用的是UI向导,则会有一个用于签出LFS的复选框

https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout
https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/pipeline-options-for-git?view=azure-devops#checkout-files-from-lfs

这篇关于如何将Git LFS与Azure Repos和管道一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆