title: "No url found for submodule path in .gitmodules" error in Azure DevOps build
body: <p>A repo ("website") has a submodule ("template"). The submodule is referenced inside a directory of the repo. The goal is to use an Azure DevOps pipeline to build the repo and submodule together. However, the Azure DevOps build throws the following errors:</p>
  
  <ul>
  <li><code>fatal: No url found for submodule path '&lt;repo directory AKA "website"&gt;/&lt;submodule directory AKA "template"&gt;' in .gitmodules</code></li>
  <li><code>[error]Git submodule update failed with exit code: 128</code></li>
  </ul>
  
  <p>Depending on adjustments to the <code>.gitmodule</code> file, this error is also thrown:</p>
  
  <ul>
  <li><code>fatal: no submodule mapping found in .gitmodules for path '&lt;repo directory AKA "website"&gt;/&lt;submodule directory AKA "template"&gt;'</code>.</li>
  </ul>
  
  <p>This question is similar to others asked on Stack Overflow, but the difference is that the default initial step in Azure DevOps builds is to check out files in the branch. So scripts (like <code>git rm --cached &lt;pathtomodule&gt;</code>) cannot be run first.</p>
  
  <p>The "website" and "template" repos are in the same Azure DevOps project.</p>
  
  <p>I have tried two ways unsuccessfully. Both are based on Microsoft documentation. This is because it's unclear to me whether a submodule from the same project can be included in a repo without providing explicit credentials.</p>
  
  <ol>
  <li><p>Via the UI:</p>
  
  <ul>
  <li>"Clean options": "All build directories"</li>
  <li>"Checkout submodules": True</li>
  <li>Branch includes a .gitmodule file: True</li>
  </ul></li>
  <li><p>By git command in a PowerShell task:</p></li>
  </ol>
  
  <p>Tried variations of both:</p>
  
  <pre><code>$AUTH=$(echo -n ":$(PAT)" | openssl base64 | tr -d '\n')
  git -c http.https://dev.azure.com/organization/project/_git/template.extraheader="AUTHORIZATION: basic $AUTH" clone https://dev.azure.com/organization/project/_git/template --no-checkout --branch master
  </code></pre>
  
  <p>and</p>
  
  <pre><code>git -c http.https://dev.azure.com/organization/project/_git/template.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" submodule update --init --recursive
  </code></pre>
  
  <ul>
  <li>Unsuccessfully tested builds on both on a branch without a .gitmodules file and on a branch with a .gitmodules file.</li>
  <li>Unsuccessfully tested build tasks in both Bash and (slightly adjusted for) PowerShell.</li>
  <li>Unsuccessfully tested the various constructions of Azure DevOps repo URLs (like <code>https://organization.visualstudio.com/project/_git/repo</code>, <code>https://$(PAT)@organization.com.visualstudio.com:/project/_git/template</code>, etc.).</li>
  </ul>
  
  <p>Other things tried are variations of the above that include <code>git submodule add</code> in the PowerShell task before the <code>submodule update</code> command,  running <code>ls -lR</code> in a Bash task to investigate whether the submodule files downloaded (the build task sometimes indicates success even though the files are missing), and endless variations of the .gitmodules file.</p>
  
  <p>As .gitmodules stands now (unsuccessfully):</p>
  
  <pre><code>[submodule "template"]
      path = &lt;repo directory AKA "website"&gt;/&lt;submodule directory AKA "template"&gt;
      url = https://dev.azure.com/organization/project/_git/template
  </code></pre>
  
  <p>Variations include things like:</p>
  
  <ul>
  <li><code>[submodule "&lt;repo directory AKA 'website'&gt;/template"]</code></li>
  <li><code>path = D:\\a\\1\\s\\&lt;repo directory AKA "website"&gt;\\&lt;submodule directory AKA "template"&gt;</code></li>
  <li><code>path = $env:Build.SourcesDirectory/template</code></li>
  <li><code>url = ../project/_git/template</code></li>
  </ul>
  
  <p>...and more plus all the various combinations. None are successful.</p>
  
  <p>I am truly stuck and appreciate any insight. Thank you.</p>