Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps Self-Hosted Agent, update Git version

I have an Azure DevOps self-hosted agent installed, and by default there is an Externals/git folder, which contains an outdated version of Git: 2.28.0.windows.1.

The agent is running under a domain service account, and this particular account has the current version of Git installed: 2.39.2.windows.1.

However any pipeline which runs will use the dated version of Git which is installed under the agent folder.

When viewing the agent Capabilities, there is a PATH variable which does contain the correct path to the service account's Git cmd path, but this seems to be overridden somehow by the pipeline.

Is there no automated way to keep the Git version on the agent up to date? Do I need to manually copy Git folders from the current install into the agent folders?

like image 340
Mike Avatar asked Oct 21 '25 12:10

Mike


1 Answers

Azure DevOps uses the git executable bundled in their agent software by default, that's probably why you are seeing this issue. From the 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.

You can also try to update the agent in the pool settings, in order to update the agent software, which may also include a Git update.

like image 107
JSON Derulo Avatar answered Oct 23 '25 09:10

JSON Derulo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!