{"id":4169,"date":"2020-05-31T15:06:34","date_gmt":"2020-05-31T15:06:34","guid":{"rendered":"https:\/\/puvox.software\/blog\/?p=4169"},"modified":"2021-11-14T13:45:48","modified_gmt":"2021-11-14T13:45:48","slug":"windows-automatically-commit-push-git-repository-once-in-every-x-day-minute-hours","status":"publish","type":"post","link":"https:\/\/puvox.software\/blog\/windows-automatically-commit-push-git-repository-once-in-every-x-day-minute-hours\/","title":{"rendered":"[Windows] Automatically Commit &#038; Push git repository once in every X day\/minute\/hours"},"content":{"rendered":"<div class=\"default-content-clss content_4169 type_post \">\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/puvox.software\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/task-scheduler-cron.jpg\" alt=\"\" class=\"wp-image-4171\" width=\"156\" height=\"140\" srcset=\"https:\/\/puvox.software\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/task-scheduler-cron.jpg 475w, https:\/\/puvox.software\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/task-scheduler-cron-300x269.jpg 300w, https:\/\/puvox.software\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/task-scheduler-cron-400x359.jpg 400w\" sizes=\"(max-width: 156px) 100vw, 156px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">There are people when have specific needs (like us) who want to setup a &#8220;cron&#8221;-like task to auto-commit &amp; push the changes to remote repository.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This can be done in Windows with the following steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Navigate into the desired repository, create the <code>autocommit.bat<\/code> file with the below contents:<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">git add -u                               REM :: Only add tracked files\ngit commit -m \"your commit message\"      REM :: Commit all your added files\ngit push origin master                   REM :: Branch (i.e. master)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Open <code>Task Scheduler<\/code> (from Start\/search) and <code>Create Basic task<\/code>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"696\" height=\"339\" src=\"https:\/\/puvox.software\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/basic-task.png\" alt=\"\" class=\"wp-image-4170\" srcset=\"https:\/\/puvox.software\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/basic-task.png 696w, https:\/\/puvox.software\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/basic-task-300x146.png 300w, https:\/\/puvox.software\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/basic-task-400x195.png 400w\" sizes=\"(max-width: 696px) 100vw, 696px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3) Name it i.e. <code>my XYZ repo autocommit<\/code> , follow the &#8220;Next&#8221; buttons and choose your <code>autocommit.bat<\/code> file, and choose periodicity it will run every &#8220;X&#8221; days once.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s all! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can see all scheduled tasks under <code>Task Scheduler Library > Active Tasks<\/code><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<div class=\"default-content-clss excerpt_4169 type_post \"><p>There are people when have specific needs (like us) who want to setup a &#8220;cron&#8221;-like task to auto-commit &amp; push the changes to remote repository. This can be done in<a class=\"excerpt-read-more\" href=\"https:\/\/puvox.software\/blog\/windows-automatically-commit-push-git-repository-once-in-every-x-day-minute-hours\/\">(Continue Reading)<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":4171,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[11],"tags":[],"class_list":["post-4169","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-software"],"_links":{"self":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/4169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/comments?post=4169"}],"version-history":[{"count":0,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/4169\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/media\/4171"}],"wp:attachment":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/media?parent=4169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/categories?post=4169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/tags?post=4169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}