备份到 github,直接输入可以但 cron 没成功

23次阅读

共计 562 个字符,预计需要花费 2 分钟才能阅读完成。

MAC M1,zsh
cron 配置的内容为:* * * * * /bin/zsh /Users/macbook/back_up.sh > /Users/macbook/cron_log_ob2.txt 2>&1

cron_log_ob2.txt的内容为:

On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
fatal: could not read Username for 'https://github.com': Device not configured

要执行的脚本的内容为:

cd Documents/obsidian
git add .
git add -A
git commit -a -m "backup from mac m1 using crontab"
git push origin main -f

为什么会显示 fatal: could not read Username for 'https://github.com': Device not configured 呢?如果直接在终端执行 /bin/zsh /Users/macbook/back_up.sh > /Users/macbook/cron_log_ob2.txt 2>&1 那么 cron_log_ob2.txt 的内容就一切正常,问题出在哪儿?

正文完
 0