title: Push to local Azure DevOps Git from Build Pipeline
body: <p><strong>Short version</strong><p>
  Can someone tell me how to set up a "Command Line Script" task within an Azure DevOps build pipeline that pushes changes to a local Git repository (in fact, the Git repository on which the pipeline is based)?</p>
  
  <p>No matter what I try, my script always times out after printing <strong><code>Pushing commits to git</code></strong>.</p>
  
  <p><strong>Longer version</strong><p>
  We are migrating existing Java/Maven projects from a Jenkins build server to an Azure DevOps build environment, and I am trying to set up a build pipeline that mimics the Jenkins "Release Staging" functionality.</p>
  
  <p>My first attempt was to call the Maven release plugin directly on the checked out sources. This involved several obstacles, most of which I was able to overcome in one way or the other:</p>
  
  <ol>
  <li>The standard Azure DevOps git environment doesn't have the required config values "user.email" and "user.name" set; this can be solved by calling <code>git config</code> in a separate "Command Line Script" task prior to pushing.</li>
  <li>Azure DevOps checks out the sources in a "detached HEAD state" - to solve this problem, the setup script tasks also calls <code>git checkout master</code>. </li>
  </ol>
  
  <p>Once this is set up, my Maven call script runs up to the point where the release plugin attempts to push to Git; the corresponding lines in the log file read</p>
  
  <pre><code>[INFO] Executing: cmd.exe /X /C "git push https://xxx.visualstudio.com/YYY/_git/zzz refs/heads/master:refs/heads/master"
  [INFO] Working directory: D:\a\1\s&lt;/code&gt;
  </code></pre>
  
  <p>After that, nothing happens (at least, nothing gets logged) until the timeout  strikes:</p>
  
  <pre><code>##[error]The operation was canceled.
  ##[section]Finishing: Maven pom.xml
  </code></pre>
  
  <p>In order to find out what causes this problem I tried a few things, among others, </p>
  
  <ul>
  <li>disabling the maven call and calling <code>git push</code> directly from the script,</li>
  <li>registering a "store" type Git credential helper (assuming that an authentication problem is responsible for the timeout), </li>
  </ul>
  
  <p>but without success. I am now running out of ideas how I could get the <code>git push</code> call to work - is there anyone out here who can help me out?</p>
  
  <p>P.S.: As you may be able to tell, I'm rather a newbie as far as Azure DevOps is concerned, so I surely don't know all tricks and features of that system. In particular, I don't know if there is anything that offers the same functionality as the Maven release plugin. We do use the Azure DevOps package management, but we want to keep separate feeds for snapshots and for release builds (the way tools like Nexus do), so we have to have a mechanism for automatically advancing release numbers, checking out and back in and building and publishing the packaged module to the release feed. </p>
  
  <p>If someone can suggest an alternative way to achieve that, I'm open to suggestions as well.</p>