title: how to set git hook executable via gradle
body: <p><strong>TLDR</strong>: how to add execute permissions / set executable via Gradle to a git hook script</p>
  
  <p>I am developing an Android app with a team and was instructed to implement a company-wide pre-push script as a git hook.</p>
  
  <p>I added a pre-push file with the script to the root directory of the project and added a copy script to copy it to the hooks folder.</p>
  
  <p>I tried adding </p>
  
  <pre><code>android {
      compileSdkVersion 27
      copy {
          from "../pre-push"
          into "../.git/hooks"
      }
      tasks.create(name: 'gitExecutableHooks') &lt;&lt; {
          Runtime.getRuntime().exec("chmod -R +x .git/hooks/");
      }
  
      defaultConfig {
          ...
      }
  }
  </code></pre>
  
  <p>the file is copied to the correct location but I get a warning </p>
  
  <blockquote>
    <p>.git/hooks/pre-push' hook was ignored because it's not set as
    executable.</p>
  </blockquote>
  
  <p>and naturally, the git hook doesn't execute. </p>
  
  <p>(P.S. this works as intended on windows machines, and only fails on MacOS and Linux machines)</p>