Push to brand new repository ‘pre-receive hook declined’


#1

Gogs Version: 0.11.66.0916
Running on WIndows Server 2019 in Docker Container on WindowsServerCore-1809
MS-SQL database

Brand new install of Gogs, gets the error below when pushing to a brand new repository.

“C:\Program Files\Git\bin\git.exe” push -u --recurse-submodules=check
–progress “TestGogs” refs/heads/master:refs/heads/master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 216 bytes | 108.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: /usr/bin/env: ‘bash’: No such file or directory
To http://opus-git.office/Nich/TestRepo.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ‘http://opus-git.office/Nich/TestRe
po.git’
Done

The problem is that when creating the repository, a bunch of sample hooks and three actual hooks are created and the pre-receive hook doesn’t run.

Directory: D:\gogs\gogs-repositories\nich\testrepo.git\hooks

Mode LastWriteTime Length Name


-a---- 28/11/2018 17:06 478 applypatch-msg.sample
-a---- 28/11/2018 17:06 896 commit-msg.sample
-a---- 28/11/2018 17:06 3327 fsmonitor-watchman.sample
-a---- 28/11/2018 17:06 96 post-receive
-a---- 28/11/2018 17:06 189 post-update.sample
-a---- 28/11/2018 17:06 424 pre-applypatch.sample
-a---- 28/11/2018 17:06 1642 pre-commit.sample
-a---- 28/11/2018 17:06 1348 pre-push.sample
-a---- 28/11/2018 17:06 4898 pre-rebase.sample
-a---- 28/11/2018 17:06 95 pre-receive
-a---- 28/11/2018 17:06 544 pre-receive.sample
-a---- 28/11/2018 17:06 1492 prepare-commit-msg.sample
-a---- 28/11/2018 17:06 99 update
-a---- 28/11/2018 17:06 3610 update.sample

If I delete the files from this folder, everything then works perfectly.

Is it possible to stop these files being created? Or is there something else that I can do to make the hook run correctly and thus let me upload my data.

Thanks!


#2

Hi, have you installed git-bash.exe?

You will not notice until things stop working…