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的内容就一切正常,问题出在哪儿?


