Hooks was ignored because it's not set as executable


#1

My gogs version is 0.11.43-1
My system is ArchLinux.

I have just changed my /etc/gogs/app.ini the part of the repository root to be a path to my external disk.

Since then, everytime that I make a push it gives me the following output:

hint: The ‘hooks/pre-receive’ hook was ignored because it’s not set as executable.
hint: You can disable this warning with git config advice.ignoredHook false.
hint: The ‘hooks/update’ hook was ignored because it’s not set as executable.
hint: You can disable this warning with git config advice.ignoredHook false.
hint: The ‘hooks/post-receive’ hook was ignored because it’s not set as executable.
hint: You can disable this warning with git config advice.ignoredHook false.

  1. When before it didn’t gave me this output. What show I do to fix this?

UPDATE:
Also after creating a new repo and following the initial page commands of the repo creation; after the first push from local, my repo page doesn’t change from this:

it is stuck

Gogs is writing to the new repo path though


#2

I think you didn’t give the user runs Gogs the permission on your external disk to set a script to be executable.


#3

Yes it can. Here is a test that I did.

[gogs@rock64 gogs_repos]$ pwd
/mnt/disco/gogs_repos
[gogs@rock64 gogs_repos]$ ls -l  
total 8
drwxr-xr-x 3 gogs gogs 4096 Apr 23 17:40 daniel
drwxr-xr-x 2 gogs gogs 4096 Apr 16 18:06 tiago
[gogs@rock64 gogs_repos]$ touch a
[gogs@rock64 gogs_repos]$ chmod +x a
[gogs@rock64 gogs_repos]$ ls -l
total 8
-rwxr-xr-x 1 gogs gogs    0 Apr 24 15:52 a
drwxr-xr-x 3 gogs gogs 4096 Apr 23 17:40 daniel
drwxr-xr-x 2 gogs gogs 4096 Apr 16 18:06 tiago

NOTE: I have also recently changed my mariadb location path to another directory recently. It has also changed the myslqd.sock path. Don’t if this may be relevant, but I guess not.


#4

I’m not pro on file permission, but I think there is a difference you chmod +x and directly create a file with permission 0777.


#5

ill try creating a file with gogs user with umask 000. My believe is that it isn’t different


#6

well this isn’t a reliable test because:

umask for files is subtracted from 666 and for directories it is subtracted from 777

tell me which files should I check to see if they are executable.

And still my repo creation page doesn’t show my files, it is stuck in the beginning commands


#7

How did you start Gogs?


#8

systemctl enable gogs started on boot


#9

Out of ideas, shouldn’t be a problem because file system takes care of that.

For quick fixes at the moment, you need to give execute permission to all the files of pre-receive, update and post-receive under path/to/repository.git/hooks/.


#10

They are set as executable.

[root@rock64 hooks]# pwd
/mnt/disco/gogs_repos/daniel/az.git/hooks
[root@rock64 hooks]# ls -l   
total 60
-rwxr-xr-x 1 gogs gogs  478 Apr 24 16:08 applypatch-msg.sample
-rwxr-xr-x 1 gogs gogs  896 Apr 24 16:08 commit-msg.sample
-rwxr-xr-x 1 gogs gogs 3327 Apr 24 16:08 fsmonitor-watchman.sample
-rwxr-xr-x 1 gogs gogs   83 Apr 24 16:08 post-receive
-rwxr-xr-x 1 gogs gogs  189 Apr 24 16:08 post-update.sample
-rwxr-xr-x 1 gogs gogs  424 Apr 24 16:08 pre-applypatch.sample
-rwxr-xr-x 1 gogs gogs 1642 Apr 24 16:08 pre-commit.sample
-rwxr-xr-x 1 gogs gogs 1348 Apr 24 16:08 pre-push.sample
-rwxr-xr-x 1 gogs gogs 4898 Apr 24 16:08 pre-rebase.sample
-rwxr-xr-x 1 gogs gogs   82 Apr 24 16:08 pre-receive
-rwxr-xr-x 1 gogs gogs  544 Apr 24 16:08 pre-receive.sample
-rwxr-xr-x 1 gogs gogs 1492 Apr 24 16:08 prepare-commit-msg.sample
-rwxr-xr-x 1 gogs gogs   86 Apr 24 16:08 update
-rwxr-xr-x 1 gogs gogs 3610 Apr 24 16:08 update.sample

The error must be coming from somewhere else, all that I did was change the /etc/gogs/app.ini. This was the change:

[repository]
; Root path for storing repositories's data, default is "~/<username>/gogs-repositories"
ROOT                        = /mnt/disco/gogs_repos

maybe you can reproduce this on your machine


#11

OK, maybe the problem is when you remote login as gogs user, it doesn’t allow you execute file on the mounted device.


#12

how can I fix this?
Before I made the change to repos root it didn’t gave this warning…
I have also made a system upgrade on the client, maybe git has changed


#13

yes, it is that.
When I do:

[gogs@rock64 gogs_repos]$ ls -l
total 12
-rwxr-xr-x 1 gogs gogs   21 Apr 24 17:16 a
drwxr-xr-x 3 gogs gogs 4096 Apr 24 16:55 daniel
drwxr-xr-x 2 gogs gogs 4096 Apr 16 18:06 tiago
[gogs@rock64 gogs_repos]$ ./a
bash: ./a: Permission denied

#14

Yes now it is working. Thank you a lot @Unknwon


#15

@dannysantos1985 problem solved by upgrade Git on the client?


#16

no, I just added exec flag to my external disk device at /etc/fstab.
exec has to be after the users flag, if there is one.
That made possible to execute files on the disk folder/sub-folders :wink:
Thank you for your help and for Gogs :smile:


#17

Good to know!