2

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?

Mike
  • 1,010
  • 1
  • 14
  • 33

1 Answers1

2

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.

JSON Derulo
  • 9,780
  • 7
  • 39
  • 56
  • Interesting...I'm wondering if that docs entry was recently added...I remember reading through that doc when I was researching this issue and don't recall that info. In any event, it's there now, it's what I need, and I appreciate your help! Thanks very much. – Mike Aug 15 '23 at 10:30
  • @Mike you are right, at the time of writing that question the docs did not contain this information. It was added in May. https://github.com/MicrosoftDocs/azure-devops-docs/commit/fe23c1671ace8e3784b9b4b0c4744133ff4bf2b4 – JSON Derulo Aug 15 '23 at 10:59