3

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.

2 Answers2

3

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)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • thanks for the tip on umask. its set as 0077.making it as 022 would if i understand correctly ensure my files will have 644 permissions right ? – Ron Abraham Oct 28 '14 at 09:49
  • the hook is named post-update in my local git hooks folder. now after ure post i tried adding the hook to the git server, but i got an error. I also tried editing the hook sample in the openshift/git/app.git/hooks folder, but it did not give me permissions to write the file there as the hooks folder is owned by root. – Ron Abraham Oct 28 '14 at 09:51
  • 1
    @RonAbraham that would explain why the hook didn't execute: it is a server hook, executed by the remote repo which receives commits. And you cannot "git add" a hook: a hook is never pushed. – VonC Oct 28 '14 at 10:37
  • @RonAbraham yes, that would be a separate issue (and you can link back to this question, that you can accept) – VonC Oct 28 '14 at 12:34
  • @Just create a new question, that will be easier to answer. I'll edit it to add the link back to this one. – VonC Oct 28 '14 at 13:05
  • thans VonC heres the [link](http://stackoverflow.com/questions/26609567/how-to-use-to-make-a-file-executable-on-openshift-server-after-pushing-it-via-gi) – Ron Abraham Oct 28 '14 at 13:27
1

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

Stephan
  • 41,764
  • 65
  • 238
  • 329
fdurmus77
  • 516
  • 7
  • 21