title: How can i specify which git executable an Azure DevOps build agent uses
body: <p>I have a git authentication problem on Azure DevOps build agent for some unknown reason authentication only works with the MacPorts version of git:</p>
  
  <pre class="lang-sh prettyprint-override"><code>&gt;/usr/bin/git clone --config "http.sslVerify=false" "https://…:…@…/DefaultCollection/…/_git/…" 
  Cloning into '…'...
  fatal: Authentication failed for 'https://…:…@…/DefaultCollection/…/_git/…/'
  
  &gt;/usr/local/bin/git clone --config "http.sslVerify=false" "https://…:…@…/DefaultCollection/…/_git/…"
  Klone nach '…' ...
  fatal: Authentifizierung fehlgeschlagen für 'https://…/DefaultCollection/…/_git/…/'
  
  &gt;/opt/local/bin/git clone --config "http.sslVerify=false" "https://…:…@…/DefaultCollection/…/_git/…" 
  Klone nach '…' ...
  remote: Azure Repos
  remote: Found 25399 objects to send. (22 ms)
  Empfange Objekte: 100% (25399/25399), 21.80 MiB | 39.24 MiB/s, Fertig.
  Löse Unterschiede auf: 100% (17128/17128), Fertig.
  </code></pre>
  
  <p>I have tried by best to make the build agent use the MacPorts version:</p>
  
  <p><a href="https://i.stack.imgur.com/JMlkj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JMlkj.png" alt="PATH"></a>
  <a href="https://i.stack.imgur.com/02Srj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/02Srj.png" alt="GIT"></a></p>
  
  <p>But still the checkout fails:</p>
  
  <pre class="lang-sh prettyprint-override"><code>##[section]Starting: Checkout
  ==============================================================================
  Task         : Get sources
  Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
  Version      : 1.0.0
  Author       : Microsoft
  Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
  ==============================================================================
  Syncing repository: repository (ExternalGit)
  ##[command]git version
  git version 2.26.2
  ##[command]git init "/Work/TFS/1/s"
  Leeres Git-Repository in /Users/Shared/Work/TFS/1/s/.git/ initialisiert
  ##[command]git remote add origin https://…/DefaultCollection/…/_git/…
  ##[command]git config gc.auto 0
  ##[command]git config --get-all http.https://…/DefaultCollection/…/_git/….extraheader
  ##[command]git config --get-all http.proxy
  ##[command]git remote set-url origin https://***:***@…/DefaultCollection/…/_git/…
  ##[command]git remote set-url --push origin https://***:***@…/DefaultCollection/…/_git/…
  ##[command]git -c http.sslVerify=false fetch --force --tags --prune --progress --no-recurse-submodules origin
  fatal: Authentifizierung fehlgeschlagen für 'https://…/DefaultCollection/…/_git/…/'
  ##[warning]Git fetch failed with exit code 128, back off 9.834 seconds before retry.
  ##[command]git -c http.sslVerify=false fetch --force --tags --prune --progress --no-recurse-submodules origin
  fatal: Authentifizierung fehlgeschlagen für 'https://…/DefaultCollection/…/_git/…/'
  ##[warning]Git fetch failed with exit code 128, back off 8.115 seconds before retry.
  ##[command]git -c http.sslVerify=false fetch --force --tags --prune --progress --no-recurse-submodules origin
  fatal: Authentifizierung fehlgeschlagen für 'https://…/DefaultCollection/…/_git/…/'
  ##[error]Git fetch failed with exit code: 128
  ##[section]Finishing: Checkout
  
  </code></pre>
  
  <p>So how can I make sure that the correct git executable is used?  I tried to search for the script managing the checkout but to no avail.</p>
  
  <p><strong>Update 1:</strong> I have deinstall the Brew version of Git but this will only result in the the macOS Version to be used. And I can't deinstall that one.</p>
  
  <p><strong>Update 2:</strong> I placed a symbolic link <code>ln -s /opt/local/bin/git /usr/local/bin/git</code>. That actually works but it's not the best of workarounds and I would like for a more clean solution.</p>