I have my git repos cloned on my site. In order to keep my git viewer up to date, I need those clones to continue to be up to date.
Thankfully, there is a simple way to do this. git does have a –git-dir=/path, However this does not appear to work. You still need to change into the working directory in order to pull the updates. So after some work, I came up with this:
for f in $FILES
if [ -d $f ] && [ -d $f/.git ]
echo "Processing Git repository, $f"
git --git-dir="$f/.git" pull -q
I simply add this as a cron tab, using > /dev/null to eat the output. However if an error occurs, I should receive a email with what exactly went on.