crontool
Paste a schedule, read it in English, see the next runs.

Auto-Committing with Git and Cron

Chain git add, commit, and push in one cron job, guarding the commit so it doesn't fail when there's nothing to change. Use the full git path and an SSH key without a passphrase so the push runs unattended.

The crontab line

*/30 * * * * cd /opt/notes && /usr/bin/git add -A && /usr/bin/git commit -m "auto $(date +\%F)" && /usr/bin/git push >> /var/log/git-cron.log 2>&1

Escape % as \% in the date. The && chain stops at the commit if nothing changed.

Don't fail on an empty commit

git commit exits non-zero when there's nothing staged, which stops the chain — that's usually fine. To always push anyway, use git commit -m msg || true before git push.

Unattended push auth

Use an SSH deploy key with no passphrase, or a stored credential helper, so git push never prompts. Configure user.name/user.email in the repo for the commit author.

FAQ

How do I auto-commit with cron?

Chain the steps: cd repo && git add -A && git commit -m "auto $(date +\%F)" && git push. Use full git paths and escape % as \%.

How do I stop cron git commit from failing when nothing changed?

git commit exits non-zero with no staged changes. Add || true after the commit if you want the job to continue regardless.

How does git push work unattended in cron?

Use an SSH deploy key without a passphrase or a credential helper so push never prompts, and set user.name/user.email in the repo.