This may be possible with the .gitattributes
filter. You can get part of the path with the following configuration:
Add this to .gitattributes
:
*.sh filter=permissions
And add this to .git/config
:
[filter "permissions"] clean = chmod 755 %f
As soon as you git add
a .sh
file, a clean filter will be applied and its permissions will be changed. Unfortunately, a permission change will not be added to the index, so this solution is clearly incomplete.
source share