title: Problem with Azure DevOps working with Git submodules
body: <p>I'm running into problems with a build pipeline I'm defining in Azure DevOps. The issue is similar to what is described in <a href="https://stackoverflow.com/questions/45820526/vsts-build-git-submodule-automatization/50337989#50337989">this post</a> but the fix cited isn't working for me. The build job <strong>Get Source</strong> task runs but the Powershell I have defined is failing because of the agent using a detached HEAD. I'm new to Git and Azure DevOps (lots of experience with SVN and TeamCity/CruiseControl.NET/NANT) so between the different commands and permissions I'm pretty stymied.</p>
  
  <p>I was able to create two test repos and made one a submodule of the other. I built a process that updates the submodule to HEAD using a Powershell task:</p>
  
  <pre><code>Write-Host
  Write-Host "RUNNING: git status"
  git status
  
  Write-Host
  Write-Host "RUNNING: git checkout SubmoduleExperiment"
  git checkout SubmoduleExperiment
  
  Write-Host
  Write-Host "RUNNING: git submodule update --remote --merge"
  git submodule update --remote --merge
  
  Write-Host
  Write-Host "RUNNING: git commit -am ""updated submodule"""
  git commit -am "updated submodule"
  
  Write-Host
  Write-Host "RUNNING: git push"
  git push https://$($env:PatForGitPushes):PAT@myTeam.visualstudio.com/MyTeam/_git/my-test HEAD:SubmoduleExperiment
  </code></pre>
  
  <p>When I apply the same task to my actual project/build, however, it fails because when I <code>git checkout master</code> it tells me I'm <code>behind 'origin/master' by 1 commit</code> even though the detached HEAD is pointing to the same commit as origin/master.</p>
  
  <p>I've set up the Get Source task between my test and the "real" build to be identical. I've set the submodule's URL to use a PAT in both.</p>
  
  <p>Any suggestions on how to fix this situation?</p>