I am writing a cron job that pushes files in directory “~/foo” to a remote server every hour.
The script that this cron job runs is located at “~/bar/backupScript.sh”. Hence, I cannot directly run such git commands as git commit -m 'backup' because “~/bar” is not a git repository.
How do I run git commands that are relevant to files in “~/foo” from “~/bar/backupScript.sh”?
cd ~/fooat the beginning of the script.