We have a git repository setup for our locally run Apache/PHP server. Everything on it works, except for pulling.
Whenever someone does a git pull
in the production repo, it changes the permissions on many different files. So we have a post-merge hook on the repo that does the following (which we've used on Linux servers successfully):
#! /QOpenSys/usr/bin/sh
echo "Fixing permissions, please be patient..."
find /path/to/htdocs -type d -exec chmod -f 775 {} \;
find /path/to/htdocs -type f -exec chmod -f 664 {} \;
find /path/to/htdocs/.git/hooks -type f -exec chmod -f 771 {} \;
chown -Rf someuser:programgroup /path/to/htdocs
chmod -Rf +x /path/to/htdocs/.git/hooks
This works on most files, but there are a few that it just doesn't change at all, one important one being .git/index
. Git sets the permissions to the index file to be
-rw-rw-r-- 1 pull_usr programgroup
, and the hook doesn't change this at all.
This makes it so any normal programmer can't pull to the same repo later on to put changes onto the live server, even though they're also in the programgroup
group. And, for some odd reason, whenever the current "owner" of the file tries to manually change the permissions, they get chown: .git/index: Not owner
.
The error we get when trying to pull as anyone else is error: unable to write new index file.
I've tried looking up how to maybe make the hook run using a higher privileged user, but since PASE has no su
or sudo
, it's pretty much a dead end.
Is there any way to get this to properly set the permissions after a pull so whoever needs to can put their changes live after approval?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745079795a4610053.html
评论列表(0条)