The problem: Create a script (shell, python, whatever) on Windows, add it to a git repository. Then clone or pull the repo on a UNIX system (Linux, macOS). The file won't get the executable permission.
If the script had been created from the beginning on a UNIX system with executable permission, this permission would have been propagated to the repo. However, on Windows, this type of permission does not exist and cannot be set at system level.
On Windows, to enforce the execution permission in the repo for a given script, use the following command to add the file:
$ git add --chmod=+x the-script.sh
If the script had already been added in the index, you can modify the permissions in the index:
$ git update-index --chmod=+x the-script.sh
To verify the permissions in the index:
$ git ls-files --stage the-script.sh
100755 991ba25219c4441389de0f50b70fb59872a9c07f 0 the-script.sh
^^^
Thank you!