I want to setup a cron job that makes a production site pull from a gitolite repository.
The following command works in a non-cron-context:
# m h dom mon dow command
* * * * * cd /home/www/test/autopulling-site/ && /usr/bin/git fetch && /usr/bin/git pull
I am suspecting that the git operation doesn’t work due to the SSH key not being sent correctly in a cron context. The logs show nothing.
Any ideas?
You need to make sure of the user actually executing the
cron.It could very well be root in this case, which means you need to make to make sure the
$HOME(when running fromcron) does contain your.ssh/id_rsa(.pub)files.But if your private key is protected by a password, don’t forget the cron session won’t know about your ssh-agent: see “Execute rsync command over ssh with an ssh agent via crontab” for a concrete example.
As noted by the OP Harold Smith,
keychainwas the missing element here.