Skip to content

Instantly share code, notes, and snippets.

@kensei
Created March 5, 2013 09:32
Show Gist options
  • Save kensei/5089066 to your computer and use it in GitHub Desktop.
Save kensei/5089066 to your computer and use it in GitHub Desktop.
git autofetch crontab
#!/usr/bin/env bash
password="password"
sourcedest="/home/git/myproject"
cd $sourcedest
echo "Updating Source..."
expect <<- DONE
set timeout 240
spawn git fetch -v --all
match_max 100000
expect "Enter passphrase for key *: "
send -- "$password\r"
send -- "\r"
expect eof
DONE
echo $(git reset --hard origin/master)
echo $(git log -1 --oneline)
LOG_DIR=/home/crontab/log
*/5 * * * * /home/bin/autogitfetch >> $LOG_DIR/auto-git-fetch.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment