title: What is the correct way to deploy CraftCMS 3 with git? I keep getting permission issues
body: <p>The way I am deploying and updating my craft 3 site now is by pushing the changes in my git repo to a bare repo on the server, which has a post-receive hook that does this:</p>
  
  <pre><code>#!/bin/sh
  GIT_WORK_TREE=/home/ubuntu/www git checkout -f
  cd /home/ubuntu/www &amp;&amp; composer install --no-interaction --prefer-dist --optimize-autoloader
  </code></pre>
  
  <p>But I can't seem to get the permissions right. Git will overwrite file modes so that the webserver can't write to directories that it needs to.</p>
  
  <p>Is there a different way I should deploy or a way to keep permissions from getting messed up?</p>