I frequently add bash scripts to my Git repository, and the scripts have executable permissions in the Linux filesystem prior to the git add. But after pushing the added files to a remote repository and pulling in another location, the files show up with non-executable permissions. There seem to be two ways to correct the problem:
-
chmod u+x $script git commit -am "fixing the script permissions... again..." -
git update-index --chmod=+x $script
Instead of fixing up the permissions every time, is there a way to have Git simply look at the file permissions on the script during git add, recognize "Hey, this here is an executable file!" and add it to the repository with the executable permissions directly?
filemode=false?filemode=falseissue. I think this is the normal behavior of git--I'm just looking for some way to skip the manual fixup step.git add --chmod=+xwill be enough! See my answer below.*.sh text eol=lf chmod=+x