title: Git dir and work tree in different servers
body: <p>I have this enviroment in web developing:</p>
  
  <p><strong>Server A</strong></p>
  
  <p>Multiple VMs (each one represents a different project). It's used for deploy.</p>
  
  <p><strong>Server B</strong></p>
  
  <p>Hosts every git bare repositories</p>
  
  <p><strong>Local machines</strong></p>
  
  <p>Each developer clones the repo, works locally, and push back to Server B bare-repo.</p>
  
  <hr>
  
  <p>The problem is that I need to have working tree in each VM (server A), but with no git directory. And maintain git directory with no working tree in server B.</p>
  
  <p>Each time a someone <code>git push</code>es to a repository, the <em>remote</em> working tree (in server A) needs to be updated.</p>
  
  <hr>
  
  <p><strong>What do I want to avoid?</strong></p>
  
  <p>I don't want a full git directory in my deploy server (Server A) because it has SSD disks and i'd take a lot of (very expensive) space.</p>
  
  <hr>
  
  <p><strong>My first approach</strong></p>
  
  <p>My first approach was to use a hook for <em>post-update</em> in Server B which basically makes <code>git archive</code> to a <code>.gz</code> file, and uses <code>scp</code> with ssh keys and then extracts it in Server A.</p>
  
  <p>PRO is that it's easy to implement.</p>
  
  <p>CON is that I'll transfer every repository files even if someone modified a single line.</p>
  
  <hr>
  
  <p>Can anyone throw me any idea? Is it possible to set GIT_WORK_TREE to a remote location? I tried via ssh with no success.</p>
  
  <p>Thanks in advance.</p>