title: Why is my .gitattributes file not working on my Mac?
body: <p>Trying to implement a terminal based workflow, becoming more fluent in Github and Git and I wanted to upload all my local AppleScript apps and scripts to a repository through the terminal.  Upon initial test upload, anything with a <code>.scpt</code> extension is treated as binary and will not render as raw but only allows a download to view raw.</p>
  <p>So researching for a way to turn binary to text so I can utilize version control I found &quot;<a href="https://stackoverflow.com/questions/15090102/should-the-gitattributes-file-be-in-the-commit">Should the .gitattributes file be in the commit?</a>&quot; and:</p>
  <p>I clone my repo locally in the terminal using:</p>
  <pre><code>git clone https://github.com/user/foobar.git
  </code></pre>
  <p>after <code>cd</code> into that directory I do: <code>touch .gitattributes</code></p>
  <p>verified file is there with: <code>ls -a</code></p>
  <p>opened the file with: <code>open .gitattributes</code></p>
  <p>added the following to <code>.gitattributes</code>:</p>
  <pre><code>## Explicitly declare text files you want to always be normalized and converted to native line endings on checkout.
  *.scpt text
  
  ## Denote all files that are truly binary and should not be modified.
  *.png binary
  *.jpg binary
  </code></pre>
  <p>back in the terminal I do <code>git commit -am &quot;adding gitattributes&quot;</code></p>
  <p>run <code>git push</code></p>
  <p>In the browser I verify that the file <code>.gitattributes</code> is present and it is and I can see it as text.</p>
  <p>I add <code>foobar.scpt</code> to my local directory.  In the terminal I run <code>ls -a</code> to verify <code>foobar</code> is present and it is.  Run <code>git add foobar.scpt</code> then use <code>git commit -am &quot;adding test script&quot;</code> and <code>git push</code>.</p>
  <p>When I open the file <code>foobar.scpt</code> in the browser it still indicates I can only download to view raw.  Researching further I found:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/18331048/how-to-setup-git-attributes">How to setup git attributes</a></li>
  <li><a href="https://stackoverflow.com/questions/15090102/should-the-gitattributes-file-be-in-the-commit">Should the .gitattributes file be in the commit?</a></li>
  <li><a href="https://stackoverflow.com/questions/7080803/how-can-i-commit-files-with-git">How can I commit files with git?</a></li>
  <li><a href="https://stackoverflow.com/questions/21691202/how-to-create-file-execute-mode-permissions-in-git-on-windows">How to create file execute mode permissions in Git on Windows?</a></li>
  <li><a href="https://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-files-from-a-git-repository">How can I Remove .DS_Store files from a Git repository?</a></li>
  </ul>
  <p>I've tried the above with:</p>
  <ul>
  <li>adding the <code>.gitattributes</code> to my local as <code>.git/info/.gitattributes</code></li>
  <li>adding the <code>.gitattributes</code> to my local as <code>.git/info/gitattributes</code> to replicate how the <code>exclude</code> file looks.</li>
  </ul>
  <p>I've changed the <code>gitattributes</code> file parameters to:</p>
  <ul>
  <li><code>*.scpt text</code></li>
  <li><code>*.scpt diff</code></li>
  </ul>
  <p>After trying all the above I'm still unable to get some files as text instead of binary.  What is the proper way to create a <code>gitattributes</code> file locally and push it to the master so that Mac files will be rendered as text and not binary?</p>
  <hr />
  <p><strong>Edit:</strong></p>
  <p>A comment suggested <a href="https://stackoverflow.com/questions/7641806/how-would-you-put-an-applescript-script-under-version-control">How would you put an AppleScript script under version control?</a> so I <code>git rm foobar.scpt</code>, <code>git commit -am &quot;removed test&quot;</code> and <code>git push</code>.</p>
  <p>After removing <code>foobar</code> locally I updated <code>..gitattributes</code> to:</p>
  <pre><code>## Explicitly declare text files you want to always be normalized and converted to native line endings on checkout.
  *.scpt diff=scpt
  
  ## Denote all files that are truly binary and should not be modified.
  *.png binary
  *.jpg binary
  </code></pre>
  <p>added to my config file (locally under <code>.git/config</code>):</p>
  <pre><code>[diff &quot;scpt&quot;]
    textconv = osadecompile
    binary=true
  </code></pre>
  <p>I've created a new script file named <code>test.scpt</code> and uploaded to through the browser and terminal and still get raw.  What am I doing wrong?</p>