Git push via cron

I am trying to run git push from cron. When I make a command interactively on the shell, it goes fine. When running a command from my crontab user, cron sends an error message

 Permission denied (publickey). 

I assume this is not related to finding or reading my ~ / .ssh / id_rsa, since I can hide the file from cron. UID and EUID are set in cron job. - Any ideas?

UPDATE

I got it while working when I supplied the SSH_AUTH_SOCK environment key to my cron job, but I am worried that this only works if I logged in. I am looking for a solution that works regardless of interactive logins.

+10
git ssh cron
Nov 03 '11 at 12:14
source share
1 answer

As explained here , this may be due to a lack of knowledge from the shell cron session of the ssh agent.
If so (i.e. if you use ssh private keys with a passphrase), keychain is the usual solution (as mentioned here ).
More in this example: " Useless connections through OpenSSH using public key authentication, key binding and AgentForward ."

+5
Nov 03 '11 at 12:33
source share



All Articles