If you see the accepted answer in:
Aggregating and uglifying javascript in a git pre-commit hook, you'll see that I had to do a chmod +x
on my pre-commit hook to get it to work.
Why is this not executable by Git by default?
Because files are not executable by default; they must be set to be executable.
The sample files from a git init
are all executable; if it's copied or renamed to a non-sample file, it will retain the original file's x
flag.
New files will be created with current defaults. In your case, view those defaults with umask
:
$ umask
0022
By default, new files won't be u+x
unless explicitly set to be.