title: Trouble with Git mirroring
body: <p>My topology:</p>
  
  <pre><code>W = Workstation w/VS.2017
  R1 = Local TFS repo
  R2 = Remote VSTS repo
  </code></pre>
  
  <p>For reasons discussed <a href="https://stackoverflow.com/q/50938180/722393">here</a>, I'm running a TFS release step that mirrors R1 to R2 every time I sync W to R1.</p>
  
  <p>(FYI the <code>Invoke-git</code> script from the other Q&amp;A is causing an unspecified Git error when it sends STDERR to the text file, so I've decided to stop using that. I've opted instead to configure the TFS release step to not fail on STDERR.)</p>
  
  <p>Here's the output from a TFS release step when mirroring from R1 to R2 after a sync from W to R1:</p>
  
  <pre><code>POST git-receive-pack (744 bytes)
  Pushing to https://Personal%20Access%20Token:********@customer.visualstudio.com/Applications/_git/Application
  To https://customer.visualstudio.com/Applications/_git/Application
    = [up to date]      master -&gt; master
    = [up to date]      origin/develop -&gt; origin/develop
    - [deleted]         Application/master
      c13bdc5..81ddbe0  origin/master -&gt; origin/master
  updating local tracking ref 'refs/remotes/Application/master'
  </code></pre>
  
  <p>This action omits several commits from R2 that exist on R1:</p>
  
  <p><strong>R1</strong></p>
  
  <p><a href="https://i.stack.imgur.com/o7dkK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o7dkK.png" alt="Local TFS repo"></a></p>
  
  <p><strong>R2</strong></p>
  
  <p><a href="https://i.stack.imgur.com/yGg8C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yGg8C.png" alt="Remote VSTS repo"></a></p>
  
  <p>Here's a test mirror from W to R2:</p>
  
  <pre><code>D:\Dev\Application&gt;git push --mirror Application
  Counting objects: 1, done.
  Writing objects: 100% (1/1), 235 bytes | 235.00 KiB/s, done.
  Total 1 (delta 0), reused 0 (delta 0)
  remote: Analyzing objects... (1/1) (187 ms)
  remote: Storing packfile... done (95 ms)
  remote: Storing index... done (44 ms)
  To https://customer.visualstudio.com/Applications/_git/Application
     67e6c4f..81ddbe0  master -&gt; master
   * [new branch]      develop -&gt; develop
   * [new branch]      Application/develop -&gt; Application/develop
   * [new branch]      Application/master -&gt; Application/master
  </code></pre>
  
  <p>This test successfully sends all of the commits to R2.</p>
  
  <p>And here's another TFS-spawned mirror from R1 to R2, AFTER the test mirror from W to R2:</p>
  
  <pre><code>POST git-receive-pack (885 bytes)
  Pushing to https://Personal%20Access%20Token:********@customer.visualstudio.com/Applications/_git/Application
  To https://customer.visualstudio.com/Applications/_git/Application
   = [up to date]      origin/develop -&gt; origin/develop
   - [deleted]         develop
   + 81ddbe0...67e6c4f master -&gt; master (forced update)
   - [deleted]         Application/develop
   + c13bdc5...67e6c4f Application/master -&gt; Application/master (forced update)
     81ddbe0..3329b73  origin/master -&gt; origin/master
  updating local tracking ref 'refs/remotes/Application/develop'
  updating local tracking ref 'refs/remotes/Application/master'
  </code></pre>
  
  <p>This is what I get when I run the mirror from R1 to R2 manually, after all of this:</p>
  
  <pre><code>D:\Agent\_work\37\s&gt;git push --mirror Application
  Everything up-to-date
  </code></pre>
  
  <p>But R2 is clearly not up to date. It's missing all commits subsequent to <code>67e6c4f3</code>.</p>
  
  <p>What am I doing wrong here? How can I get R2 to always be an exact copy of R1?</p>