title: git commit doesn't work from a cron job, although git pull does work
body: <p>In my crontab, I have the following line:</p>
  
  <pre><code>48 14 * * * bash /home/erelsgl/git/erel-sites/add-commit-push.bash "from home" 2&amp;&gt;1 &gt;&gt; /home/erelsgl/logs/backup_from_home.log
  </code></pre>
  
  <p>The script does what its name implies - add, commit and push:</p>
  
  <pre><code>DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &amp;&amp; pwd )"
  cd $DIR
  echo --------------------
  date
  echo == add ==
  /usr/bin/git add -A
  echo == commit ==
  /usr/bin/git commit -m "$1"
  echo == pull ==
  /usr/bin/git pull
  echo == push ==
  /usr/bin/git push
  </code></pre>
  
  <p>As seen in the log file, the "commit" does nothing while the "pull" works fine:</p>
  
  <pre><code>Fri Oct 23 14:48:01 IDT 2015
  == add ==
  == commit ==
  == pull ==
  Already up-to-date.
  == push ==
  </code></pre>
  
  <p>I ran the exact same command, a minute later, from the command line, and got the following log, which means that the commit did happen:</p>
  
  <pre><code>Fri Oct 23 14:49:31 IDT 2015
  == add ==
  == commit ==
  On branch master
  Your branch is up-to-date with 'origin/master'.
  
  nothing to commit, working directory clean
  == pull ==
  Already up-to-date.
  == push ==
  </code></pre>
  
  <p>What is the problem in running commit from a cron job?</p>
  
  <p>NOTE: I also did the same experiment with an actual change in a test file. I found out that, indeed, the commit didn't happen from the crontab (nothing was pushed to upstream) but did happen from the command line.</p>