Ssh
帶有 SVN 和 Git 的 Crontab
我有一些在 SVN 和 Git 中的儲存庫。我的使用者名是 guyfawkes,在我的主目錄中有 www 文件夾,其中包含我所有的儲存庫。在這個目錄中,我還有文件 update.sh:
[guyfawkes@guyfawkes-desktop ~/www]$ cat update.sh cd /home/guyfawkes/www cd crm echo "upd crm" svn up echo "update crm completed" echo "-------" cd ../crm_sql echo "upd sql" svn up echo "update sql completed" echo "-------" cd ../crm_old echo "upd old" svn up echo "update old completed" echo "-------" cd ../mysqldiff echo "upd mysqldiff" git pull sotmarket master echo "update mysqlidff completed" git push origin master echo "push to github completed" echo "-------" cd ../mysql-migration-manager echo "upd mmmm" git pull echo "mmm updated" cd data echo "upd data" git pull echo "data updated"
我的 crontab 是:
[guyfawkes@guyfawkes-desktop ~/www]$ crontab -l */5 * * * * /home/guyfawkes/www/update.sh
因此,它與 svn repos 完美配合,但我在 /var/spool/mail/guyfawkes 中有這些郵件(來自 cron):
X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <HOME=/home/guyfawkes> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=guyfawkes> X-Cron-Env: <USER=guyfawkes> upd crm Fetching external item into 'public/old' External at revision 32674. At revision 483. update crm completed ------- upd sql At revision 29. update sql completed ------- upd old At revision 32674. update old completed ------- upd mysqldiff Permission denied (publickey,keyboard-interactive). fatal: The remote end hung up unexpectedly update mysqlidff completed Permission denied (publickey). fatal: The remote end hung up unexpectedly push to github completed ------- upd mmmm Permission denied (publickey,keyboard-interactive). fatal: The remote end hung up unexpectedly mmm updated upd data Permission denied (publickey,keyboard-interactive). fatal: The remote end hung up unexpectedly data updated
我該如何解決?
問題是您正在嘗試從需要 ssh 密鑰的 github 進行更新。在您的伺服器上創建一個沒有密碼的專用 ssh 密鑰並將其添加到您的 github 帳戶或使用 http-readonly uri 更新您的儲存庫:
git pull --mirror https://github.com/account/repository.git