本文介绍了使用cron作业推送到GitHub - 权限被拒绝(publickey)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个SSH密钥(位于之后) ),将其添加到GitHub并创建一个Bash脚本,提交并将一个文件推送到Github上的存储库。当我从命令行运行这个脚本,一切正常,更新推送。但是,当我使用 crontab -e 设置作业时,push会生成以下错误:

I have created an SSH key (following the official tutorial), added it to GitHub and created a Bash script that commits and pushes a single file to my repository on Github. When I run this script from the command line, everything works fine and the updates are pushed. However, when I set up a job using crontab -e, the push generates the following error:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

我编辑了用户的crontab c $ c> crontab -e ),即我不使用 sudo crontab -e 。我正在运行Ubuntu 12.04。

I have edited the user's crontab (crontab -e), i.e. I'm NOT using sudo crontab -e. I'm running Ubuntu 12.04.

推荐答案

如果不是用户问题右侧$ HOME / .ssh文件夹),则可能是:

if it isn't a user issue (where you run the job as root, missing the right $HOME/.ssh folder), it can be a passphrase issue:

密码详细信息,请参见:

The passphrase bit is detailed in "Not able to ssh in to remote machine using shell script in Crontab":

这篇关于使用cron作业推送到GitHub - 权限被拒绝(publickey)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 03:49