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:
1. chmod u+x $script
git commit -am "fixing the script permissions... again..."
or
2. 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 that "hey, this here is an executable file!" and add it to the repository with the exectuable permissions directly?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…