title: Executing git commands inside a build job in Visual Studio Team Services (was VSO)
body: <p>[Environment: Team Services, GIT, hosted build agent]</p>
  
  <p>I'd like to create a Team Services build definition that is able to do the following:</p>
  
  <ol>
  <li><p>Executing a script to generate some new files based on existing files in the repo</p></li>
  <li><p>Commit/push those generated files back to repo</p></li>
  </ol>
  
  <p>I can do #1 with no problem. But I'm not sure how I can do #2.</p>
  
  <p>I discovered I was actually able to run git.exe from inside a build job. But I'm not sure how I can pass the credential to git. Based on the build logs, it's failing because it's trying to get the username from stdin.</p>
  
  <p>I tried adding a step in the build definition with something like "git config --global user.name xxxx" but it still didn't help.</p>
  
  <p>Is this a supported scenario at all? Any suggestions?</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p><strong>Edit</strong></p>
  
  <p>I tried the following approach in my build script:</p>
  
  <pre><code>git -c http.extraheader="AUTHORIZATION: bearer %SYSTEM_ACCESSTOKEN%" pull ...
  </code></pre>
  
  <p>It seemed to work for commands like pull, etc. But when I was trying to push the changes, I got the below error:</p>
  
  <pre><code>fatal: unable to access 'https://example.visualstudio.com/SampleTeam/_git/SampleRepo/': SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054
  </code></pre>
  
  <p>Thoughts?</p>