git push通过cron [英] git push via cron
问题描述
我试图从cron运行 git push
。当我在shell上交互地执行命令时,它正在经历。当从我的用户的crontab运行命令时,cron提供错误消息
权限被拒绝(publickey)。
我认为它与查找或读取我的〜/ .ssh / id_rsa无关我可以猫的文件从cron好吧。 UID和EUID在cron作业中设置正确。 - 任何想法?
UPDATE
当我提供环境密钥SSH_AUTH_SOCK给我的cron作业时,但我担心这只有在我登录时才有效。我正在寻找一个独立于交互式登录的解决方案。
如这里解释,它可能是由于缺乏sron代理的cron会话shell的知识。
如果是这种情况(即如果您使用私有ssh键带有密码), 钥匙扣 是常用解决方案(如这里提到)。
此示例中的更多详细信息:通过OpenSSH使用公共密钥进行无密码连接
身份验证,钥匙扣和AgentForward 。
I'm trying to run a git push
from cron. When I do the command interactively on the shell it's going through fine. When running the command from my user's crontab, cron delivers the error message
Permission denied (publickey).
I presume it hasn't to do with finding or reading my ~/.ssh/id_rsa, as I can cat the file from cron alright. UID and EUID are set fine in the cron job. - Any ideas?
UPDATE
I got it working when supplying the environment key SSH_AUTH_SOCK to my cron job, but I'm concerned that this is only valid as long as I'm logged in. I'm looking for a solution that works independent of interactive logins.
As explained here, it can be due to the lack of knowledge from the cron session shell of the ssh agent.
If that is the case (ie if you are using private ssh keys with a passphrase), keychain is the usual solution (as mentioned here).
More details in this example: "Passwordless connections via OpenSSH using public key
authentication, keychain and AgentForward".
这篇关于git push通过cron的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!