嘿,我正在尝试在Mac上使用定时任务将代码推送到git。我使用crontab -e
编辑我的crontab文件,并在其中添加以下内容:
* 12 * * 1 ~/Dropbox/MD/sync.sh
* 12 * * 5 ~/Dropbox/MD/sync.sh
脚本内容如下:
#!/bin/bash
cd ~/Dropbox/MD
/usr/bin/git add .
/usr/bin/git commit -m "Docs auto update"
/usr/bin/git push origin master
然而该命令失败,当我运行mail
时,我可以检查到错误消息是:fatal: could not read Username for 'https://github.com': Device not configured
。如何解决这个问题?如果我从终端手动运行命令,就没有任何问题,也不需要输入用户凭据。
非常感谢您提供的任何提示!谢谢!