diff --git a/update.sh b/update.sh index 3aea72d..e7db495 100755 --- a/update.sh +++ b/update.sh @@ -1,6 +1,13 @@ #!/bin/sh -TARGET_DIR="$HOME/Documents/COURS" +# Set PATH so cron can find git, date, ssh, etc. +export PATH="/usr/local/bin:/usr/bin:/bin" + +# Explicitly set target directory (don't rely on $HOME in cron) +TARGET_DIR="/home/benji/Documents/COURS" + +# If using SSH keys, specify the key for Git +export GIT_SSH_COMMAND="ssh -i /home/benji/.ssh/grond -o IdentitiesOnly=yes" # Navigate to target directory cd "$TARGET_DIR" || { @@ -8,7 +15,7 @@ cd "$TARGET_DIR" || { exit 1 } -# Pull remote changes rebase-style to prevent messy merge commits +# Pull remote changes rebase-style git pull --rebase --autostash || { echo "Git pull failed" exit 1