To backup my sql database i have a cron job running that makes a mysql dump. Now i want to create another cron job that commits this dump to the repo, the problem now is that it doesn't work.
In the cron log i see the line where the command gets run but nothing is commited.
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin MAILTO=root HOME=/ 49 16 * * * cd /path/to/backup/folder/ && /usr/local/bin/git commit -am "Updating DB backup"
This is what i put in crontab -e. I also tried this in /etc/crontab, where i put root as user and that works but only as root user which is a problem because of the git post-commit hook that does push after something is commited. Since only my user is allowed to push this doesn't work when root doest the commit.
Since its working with the root user i'm thinking it's a permissions problem, but permissions of what? These commands work in normal command line.
When catching the stdout and stderr i get the following in the log.
Permission denied (publickey).^M fatal: The remote end hung up unexpectedly
so it doesn't really runs as my user or can't find the key?