Git Install Script How to enter shell command

我们两清 提交于 2019-12-30 10:32:38

问题


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.


回答1:


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)




回答2:


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



来源:https://stackoverflow.com/questions/26602640/git-install-script-how-to-enter-shell-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!