Reputation: 2443
I use root
to run git,the files permission mode changed to root 644
each time when I checkout, which means apache
cannot delete,modify.
Then I decide to make GIT to checkout files with permission 777
. I know set umask 000(default is 022
) can do that, but I don't want to change my centos setting.
How to do it?
Upvotes: 5
Views: 13996
Reputation: 2443
find . -type f -not -name '.git*' | xargs chmod 777
find . -type d -not -name '.git*' | xargs chmod 666
I use this in post-checkout hooks and seemed without any problem till now.
Upvotes: 1
Reputation: 94397
git config core.sharedRepository 0664
. See git help config.
PS. I use mode 664 because it's more secure than wide-open 666. Git adds executable bit (thus making the mode 775 or 777) for directories automatically.
Upvotes: 2
Reputation: 1323145
With Git 2.9 or more, you can do
git add --chmod=+x -- afile
git commit -m "Executable!"
Then, on the next clone or checkout, the file will be executable.
Sidenote: a proper umask
would be 022 (for 755) or 002 for 775. 777 is generally not recommended.
Note 777 (even with git update-index
) does not make sense, as Git itself does not record write: only 644
or 755
, spelled 100644
and 100755
, with the 100
part meaning "regular file".
Upvotes: 3