Back to Cron Helper
Recipegitdevopsdeploymentci-cd

Git Auto-Pull (Simple Deploy)

Periodically pull changes from Git (Simple CI/CD).

For simple deployments or syncing configuration files, you can use cron to pull changes from a Git repository automatically. Note: Ensure your server has the correct SSH keys set up to authenticate with GitHub/GitLab without a password.

Cron Schedule

Every 5 Minutes*/5 * * * *
Runs at minutes 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 of every hour.

Command to Run

Copy and paste this command into your crontab or automation script

cd /var/www/app && git pull origin main
This command will run according to the cron schedule above.

Implementation Examples

Here are code examples for implementing this cron job in different programming languages:
Unix/Linux Crontab
*/5 * * * * /path/to/script.sh
Python (with schedule library)
schedule.every(5).minutes.do(job)
Node.js (with node-cron)
cron.schedule('*/5 * * * *', () => {
  console.log('Running every 5 minutes');
});
Go (with robfig/cron)
c.AddFunc("*/5 * * * *", func() { fmt.Println("Run every 5 mins") })
GitHub Actions Workflow
- cron: "*/5 * * * *"

Related Cron Recipes

Automate PostgreSQL Backups Daily

How to schedule a daily PostgreSQL database backup using cron.
databasepostgresbackup

Automate MySQL Backups Daily

Schedule a daily MySQL database dump using cron.
databasemysqlbackup

Automate MongoDB Backups Daily

How to schedule a daily MongoDB backup using cron.
databasemongodbbackup

Automate Redis RDB Snapshots

Schedule a Redis background save (snapshot) via cron.
databaserediscache

PostgreSQL Vacuum Analyze

Automate PostgreSQL database maintenance with VACUUM ANALYZE.
databasepostgresmaintenance

Sync Folder to AWS S3

Cron job to sync local files to an AWS S3 bucket.
awscloudbackup