[Windows] Automatically Commit & Push git repository once in every X day/minute/hours

There are people when have specific needs (like us) who want to setup a “cron”-like task to auto-commit & push the changes to remote repository.

This can be done in Windows with the following steps:

  1. Navigate into the desired repository, create the autocommit.bat file with the below contents:
git add -u                               REM :: Only add tracked files
git commit -m "your commit message"      REM :: Commit all your added files
git push origin master                   REM :: Branch (i.e. master)

2. Open Task Scheduler (from Start/search) and Create Basic task:

3) Name it i.e. my XYZ repo autocommit , follow the “Next” buttons and choose your autocommit.bat file, and choose periodicity it will run every “X” days once.

That’s all!

You can see all scheduled tasks under Task Scheduler Library > Active Tasks

Leave a Comment

Your email address will not be published. Required fields are marked *

Puvox - Blog
Scroll to Top