Permission denied (publickey) when using crontab

999 Views Asked by At

I'm trying to setup a cronjob to perform a "git fetch"

I have correctly generated the ssh keys to connect to github over ssh (i have have put the public key into my github account). And it works perfect in command line.

(I have added the the priv key using ssh-add so when I connect to github it onlyasks the passphrase once)

But when I create a crontab -e (with a normal user, not root)

*/1 * * * * cd /home/bitnami/repoi.git && /opt/bitnami/git/bin/git fetch -q --all -p >>/home/bitnami/cronrun 2>&1

I get this error:

error: Could not fetch origin
Permission denied (publickey).

it is like the cron job doesn't know the keys ?

How can I make this work?

THank you

0

There are 0 best solutions below