title: Windows .bat file to schedule git add, commit and push to Github
body: <p>I need to schedule a task in Windows Server 2008 R2 to automatically push files from a folder to Github Enterprise (I don't think the "Enterprise" part will make it different than regular Github, except that ssh authentication is required).</p>
  
  <p>Here's what I've done:</p>
  
  <ol>
  <li>Set up a public/private key pair and added them to Github and .ssh, respectively</li>
  <li>Created a Github repo and cloned it to a local folder</li>
  <li>Manually ran through the <code>add</code>, <code>commit</code>, and <code>push</code> steps to make sure it works that way</li>
  <li>Tried to write a .bat file for automatically doing step #3</li>
  <li>Scheduled the task to run as my user, with highest privileges, in the target folder</li>
  </ol>
  
  <p>Unfortunately, the task fails because I am not writing the .bat file correctly. </p>
  
  <p>This was my attempt at the .bat file:</p>
  
  <pre><code>echo git add . | "C:\Program Files\Git\bin\git.exe" 
  echo git commit -m 'scheduled commit' | "C:\Program Files\Git\bin\git.exe" 
  echo git push | "C:\Program Files\Git\bin\git.exe" 
  </code></pre>
  
  <p>I found a good resource on how to do this, but it is unfortunately very Linux-specific.</p>