Git Install Script How to enter shell commands
This is more of a Git-related issue than OpenShift.
When I use git to push files to a git server, I see that the file permissions for my perl index.cgi
file change to 700 in my openshift repository.
So every time I do a push, I have to log in to the server using ssh and do chmod a+x index
in my $OPENSHIFT_REPO_DYR
.cgi change it to 755
I read in the
git docs that a hook can be added, and I tried updating the post-update script in the hooks directory with the following command
exec chmod a+x $OPENSHIFT_DATA_DIR/index.cgi
However, this does not seem to have worked.
Can you tell me what I’m doing wrong?
How do I make sure I don’t have to change chmod
every time I push a file?
How to execute shell commands via git install script (I don’t know what an install script is, I think it means Hook).
Based on the following suggestion, I thought I needed to add a hook to the server, so I tried, but got an error
$ git add .git/hooks/post-update
Error: Invalid path '.git/hooks/post-update'
Error: Unable to add .git/hooks/post-update to index
So I tried some options that used action hooks by using local .openshift/ Place a Start in the action_hooks directory.
The command I’m trying to use is
exec chmod a+x register.cgi and even chmod a+x register.cgi
Bad luck. Any input. I’m going to use it as a separate q against actionhooks.
Solution
This is more of a git related question than openshift.
In fact, it’s more closely related to openshift than to Git: Git only records 644 and 755 permissions
But the target system that manages checkouts (and updates the work tree) sets permissions based on default umask
. (In your case it could be 077
).
Make sure that the default umask
is 022
.
Regarding the Hook, check its name (‘post-update
‘, no extension) and permissions (it must be executable, 755 would be useful).