title: How do I add Git to MSBuild script?
body: <p>I'm trying to add Git check-in as part of my MSBuild script. I want to:</p>
  
  <ol>
  <li>Commit the files with a message</li>
  <li>Push the commit</li>
  <li>Tag the build</li>
  <li>Push the tag</li>
  </ol>
  
  <p>The build script is in ./Build/ (where . is the solution folder).</p>
  
  <p>I'm using:</p>
  
  <pre><code>&lt;Target Name="Committed" DependsOnTargets="SignedInstaller"&gt;
    &lt;Exec Command="&amp;quot;$(GitInstallationFolderPath)cmd\git.exe&amp;quot; --git-dir=..\.git --work-tree=.. commit -m &amp;quot;$(Changes)&amp;quot;"/&gt;
    &lt;Exec Command="&amp;quot;$(GitInstallationFolderPath)cmd\git.exe&amp;quot; --git-dir=..\.git --work-tree=.. push"/&gt;
    &lt;Exec Command="&amp;quot;$(GitInstallationFolderPath)cmd\git.exe&amp;quot; --git-dir=..\.git --work-tree=.. tag -a v$(VersionNumber) -m &amp;quot;$(Changes)&amp;quot;"/&gt;
    &lt;Exec Command="&amp;quot;$(GitInstallationFolderPath)cmd\git.exe&amp;quot; --git-dir=..\.git --work-tree=.. push -- tags"/&gt;
  &lt;/Target&gt;  
  </code></pre>
  
  <p>The custom properties are all OK.</p>
  
  <p>The first commit exits with 1 and breaks the build.</p>
  
  <p>I'm not sure if I just need to tweak this, or if I'm going about it all wrong, so advice would be welcome. I need to do some to add any new files to Git too - just haven't got that far yet. I do want to stick with MSBuild, though as we have a lot of scripts now. I just want to remove my SVN targets and move to Git.</p>