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 .scpt
extension is treated as binary and will not render as raw but only allows a download to view raw.
So researching for a way to turn binary to text so I can utilize version control I found "Should the .gitattributes file be in the commit?" and:
I clone my repo locally in the terminal using:
git clone https://github.com/user/foobar.git
after cd
into that directory I do: touch .gitattributes
verified file is there with: ls -a
opened the file with: open .gitattributes
added the following to .gitattributes
:
## 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
back in the terminal I do git commit -am "adding gitattributes"
run git push
In the browser I verify that the file .gitattributes
is present and it is and I can see it as text.
I add foobar.scpt
to my local directory. In the terminal I run ls -a
to verify foobar
is present and it is. Run git add foobar.scpt
then use git commit -am "adding test script"
and git push
.
When I open the file foobar.scpt
in the browser it still indicates I can only download to view raw. Researching further I found:
- How to setup git attributes
- Should the .gitattributes file be in the commit?
- How can I commit files with git?
- How to create file execute mode permissions in Git on Windows?
- How can I Remove .DS_Store files from a Git repository?
I've tried the above with:
- adding the
.gitattributes
to my local as.git/info/.gitattributes
- adding the
.gitattributes
to my local as.git/info/gitattributes
to replicate how theexclude
file looks.
I've changed the gitattributes
file parameters to:
*.scpt text
*.scpt diff
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 gitattributes
file locally and push it to the master so that Mac files will be rendered as text and not binary?
Edit:
A comment suggested How would you put an AppleScript script under version control? so I git rm foobar.scpt
, git commit -am "removed test"
and git push
.
After removing foobar
locally I updated ..gitattributes
to:
## 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
added to my config file (locally under .git/config
):
[diff "scpt"]
textconv = osadecompile
binary=true
I've created a new script file named test.scpt
and uploaded to through the browser and terminal and still get raw. What am I doing wrong?