我安装了 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/