奇怪的困境我在这里。我正在尝试在cronjob中运行此代码:
cd /home/justi180/public_html; git add *; git commit -m "Auto commit"; git push origin master;
当我在终端中运行上述内容时,它可以工作。但是,当我在cronjob中运行它时,它不起作用。尝试提交时cronjob的输出如下所示:
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: logs/popularity/daily.json
# modified: logs/popularity/monthly.json
# modified: logs/popularity/totals.json
# modified: logs/popularity/visitors.json
# deleted: thisisatest
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
我还通过在命令前面粘贴whoami
来确认作业是以我的用户身份运行的。我真的不确定该怎么做;该作业正在以正确的用户身份运行,并且显然正在查找要运行的git
命令,因此我正常的cron调试并没有真正把我带到任何地方。
答案 0 :(得分:2)
而不是执行git add *试试这个:
git add -u
git add -A