Forum Discussion
How to ensure that azure pipeline self-hosted windows-build-agent uses specific git & gitconfig?
We have a set of self hosted (on-prem) windows agents. The agents runs typical git-checkout in a build. The agent uses a git binary & essentially 'gitconfig' from the path "D:/azure-agent/wntado-002/externals/git/etc/gitconfig'. The fails to notice the gitconfig set by admin at 'D:/tools/git/etc/gitconfig'
We want to agent to leverage the specific 'gitconfig' set at server.
Following example illustrates the need for such setting. One of project build fails due to 'file path too long' error. The resolution is to set `core.longpath true' in gitconfig. 
We have applied the same setting in 'agent's gitconfig' (d:/azure-agent/....) but this is now a manual overhead esp. every time agent is reinstalled. I am hoping there is better way to handle it.
1 Reply
How about using System.PreferGitFromPath:
You can instruct Azure Pipelines to use the Git version installed on your server, along with its gitconfig:
variables: System.PreferGitFromPath: trueOr, if you're using classic pipelines, you can add it in the pipeline UI under Variables.
This tells the agent to prefer the Git executable found in the system PATH, which will also respect the config at this path say D:/tools/git/etc/gitconfig.