Git安装脚本如何输入shell命令 [英] Git Install Script How to enter shell command

查看:240
本文介绍了Git安装脚本如何输入shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与openshift相比,这更多是与git相关的问题.
当我使用git将文件推送到git服务器时,我发现我的openshift存储库中的perl index.cgi文件的文件权限更改为700.
因此,每次执行推送操作时,都必须使用ssh登录服务器,并在$OPENSHIFT_REPO_DIR中执行chmod a+x index.cgi,将其更改为755.

我阅读了git文档,可以添加一个钩子,我尝试使用以下命令更新钩子目录中的更新后脚本

exec chmod a+x $OPENSHIFT_DATA_DIR/index.cgi

但是那似乎没有用.

您能告诉我我在做什么错吗?
如何确保每次推送文件时都不必进行chmod更改?

一个人如何通过git install脚本执行shell命令(我不知道什么是安装脚本,我认为这意味着钩子)

基于以下建议,我认为我需要将钩子添加到服务器,所以我尝试了一下,但是出现了错误

$ git add .git/hooks/post-update error: Invalid path '.git/hooks/post-update' error: unable to add .git/hooks/post-update to index

所以我尝试通过动作挂钩尝试一些选项,方法是在其中添加开始"本地.openshift/action_hooks目录.

我尝试使用的命令是 exec chmod a+x register.cgi甚至chmod a+x register.cgi

运气不好.任何输入.我将以此作为对付行动挂钩的单独问题.

解决方案

与openshift相比,这更多是与git相关的问题.

实际上,它与openshift的关系比与Git的关系更大: Git仅记录644和755权限. /p>

但是管理结帐(和更新工作树)的目标系统将根据默认 umask (在您的情况下为077).
确保默认的umask022.

关于钩子,请检查其名称('post-update',无扩展名)和权限(它必须是可执行的,755才有用)

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)

这篇关于Git安装脚本如何输入shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆