简体   繁体   中英

Git Install Script How to enter shell command

This is more of a git related question than openshift.
When I push files to the git server using git, I see that the file permissions of my perl index.cgi file gets changed to 700 in my openshift repo.
Hence every time I do a push, I have to log in to the server using ssh and do a chmod a+x index.cgi in my $OPENSHIFT_REPO_DIR to change it to 755.

I read in the git documentation it is possible to add a hook 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 that does not seemed to have worked.

Can you please tell me what I am doing wrong ?
How can I ensure I don't have to make the chmod change every time I push files ?

How does one execute shell commands via the git install script (I don't know what is install script, I assume it means the hooks)

based on a below suggestion i thought i would need to add the hook to the server so i tried it but i 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 using action hooks by placing a "start" in the local .openshift/action_hooks directory.

The command there ive tried to use was exec chmod a+x register.cgi and even chmod a+x register.cgi

Not much luck. Any inputs. I will be raising this as a separate q against actionhooks.

This is more of a git related question than openshift.

Actually, it is more related to openshift than it is to Git: Git only records 644 and 755 permissions .

But the destination system managing a checkout (and updating a working tree) would set the permission according to the default umask (which could be in your case 077 ).
Make sure the default umask is 022 .

Regarding the hook, check its name (' post-update ', no extension) and permission (it must be executable, 755 would be useful)

Bring authority in this case gitweb folder.

gitweb/
drwxr-xr-x 3 root root 4096 Sep 25 12:01 .
drwxr-xr-x 225 root root 12288 Oct 27 20:10 ..
-rwxr-xr-x 1 root root 251319 Sep 23 04:36 gitweb.cgi
lrwxrwxrwx 1 root root 10 Sep 23 04:36 index.cgi -> gitweb.cgi
drwxr-xr-x 2 root root 4096 Sep 25 12:01 static

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM