title: Automatically sync 2 writable git repositories
body: <p>I am working in a small office, where we are using <strong>git</strong> with a <strong>central repository at a windows share</strong>, where we can PUSH to and PULL from.
  To be able to work from home, travel etc, we want to have a possibility to reach a central repo from "the outside world". Our internet connection is very, very slow, so it is no possibility to have just one central repository "inside" or "outside".</p>
  
  <p>My simple attempt was the following:</p>
  
  <ul>
  <li>Make a central repository at the internal WIN network share: <code>git init --bare</code></li>
  <li>Make one "outside" (e.g. github or an external WIN share or anything else)</li>
  <li>At the internal repo call <code>git remote add EXTERNALREPO &lt;pathToIt&gt;</code></li>
  <li>and make a batch running every x minutes/hours, saying <code>git fetch --tags EXTERNALREPO</code>, <code>git push --tags EXTERNALREPO</code></li>
  </ul>
  
  <p>When working "inside", clone/push/pull the internal repo, when on the road, use the external repo for that.</p>
  
  <p>Question: <strong>Is this the way to go, is there a better way, or am I completely wrong?</strong></p>
  
  <p>Related: </p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/18780746/two-way-git-mirror">Two-way git mirror</a> – 
  I do not think that wee need locking as we are not so many people. </li>
  <li><a href="https://stackoverflow.com/questions/11588296/safe-master-master-setup-with-git-writable-git-mirror">Safe master-master setup with git? (writable git mirror)</a> </li>
  <li><a href="https://stackoverflow.com/questions/17596503/how-to-keep-2-git-repositories-in-sync-automatically">How to keep 2 git repositories in sync automatically</a> – As far as I know, a push lasts as long as it take to run all the hooks, AND since using a windows share, the CLIENT has to run it, so it wouldn't be a solution.</li>
  </ol>
  
  <p><strong>Update 1</strong>: I now came up with a slightly adjusted configuration.</p>
  
  <ul>
  <li>INTERNAL repo on an internal Windows Share: <code>git init --bare</code></li>
  <li>EXTERNAL repo on an external Windows Share: <code>git init --bare</code></li>
  <li><p>Both repos:</p>
  
  <pre><code>git config receive.denyNonFastForwards 1
  git config receive.denyDeletes 1
  git remote add {INTERNAL|EXTERNAL} file:///...
  </code></pre></li>
  <li><p>Every x seconds/minutes/hours, call <code>git push --all {INTERNAL|EXTERNAL}</code> and <code>git push --tags {INTERNAL|EXTERNAL}</code>, <strong>at first at the internal, then at the external repository</strong>.</p></li>
  </ul>