azure-devops - Azure DevOps 自托管代理,更新 Git 版本

标签 azure-devops azure-pipelines azure-devops-self-hosted-agent

我安装了 Azure DevOps 自托管代理,默认情况下有一个 Externals/git 文件夹,其中包含过时版本的 Git:2.28.0.windows.1

代理在域服务帐户下运行,并且此特定帐户安装了当前版本的 Git:2.39.2.windows.1

但是,任何运行的管道都将使用安装在代理文件夹下的最新版本的 Git。

查看代理功能时,有一个 PATH 变量,它包含服务帐户的 Git cmd 路径的正确路径,但是这似乎被管道以某种方式覆盖。

是否没有自动方法可以使代理上的 Git 版本保持最新?我是否需要手动将 Git 文件夹从当前安装复制到代理文件夹中?

最佳答案

Azure DevOps 默认使用其代理软件中捆绑的 git 可执行文件,这可能就是您看到此问题的原因。来自 docs :

By default, the Windows agent uses the version of Git that is bundled with the agent software. Microsoft recommends using the version of Git that is bundled with the agent, but you have several options to override this default behavior and use the version of Git that the agent machine has installed in the path.

  • Set a pipeline variable named System.PreferGitFromPath to true in your pipelines.
  • On self-hosted agents, you can create a file named .env in the agent root directory and add a System.PreferGitFromPath=true line to the file.

您还可以尝试在池设置中更新代理,以更新代理软件,其中可能还包括 Git 更新。

关于azure-devops - Azure DevOps 自托管代理,更新 Git 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75804358/

相关文章:

azure - 从 DevOps 管道中的服务主体生成 SAS token (自托管)

azure - ##[错误]本地不存在带有标签 : icndpaksacr. azurecr.io/autopipe 的图像

azure-devops - 如何使用Azure Key Vault中的证书/ key 对使用Azure Pipelines构建的代码进行签名?

azure-devops - VSTS - 基于文件夹更改触发构建

azure - 使用 azure 构建管道、自托管代理和 docker-desktop 创建 docker 镜像

azure-devops - 我可以在 Windows 自托管代理和 Azure 管道上运行 Xamarin UITests 吗?

uwp - 如何绕过 Azure Devops 构建管道中的 UWP 应用程序认证?

reactjs - 通过 Azure CLI 基于 Azure DevOps git 存储库部署 ReactJs Azure 静态 Web 应用程序

azure - 将 MyActivity 添加到事件选择列表以在 Azure Devops Services 中进行容量规划

azure-devops - 有没有办法在Azure Pipelines条件中使用自定义变量