Pre-receive hook declined (GUI not updated with latest updated time)

  • Gogs version: Gogs version gogs_0.11.86_windows_amd64_mws
  • Git for Windows v2.20.1
  • Operating system: Windows 10
  • Database:
    • SQLite
  • Can you reproduce the bug at try gogs:
    • No

I try and push to new repo and receive “Error encountered while pushing to the remote repository: rejected master -> master (pre-receive hook declined)” I have removed the files from the repository\hook folder and the push will work.
But I have two other issues now which I believe are being caused by the removal of the post-receive, pre-receive and update hook files

  1. That’s fine but I have also set up webhooks to talk to a local jenkins installation. If I trigger the call from the web ui by clicking “test delivery” the delivery to jenkins is fine and triggers the job. BUT if I push using git to the gogs repository nothing is triggered. Nothing shows up in any logs and the delivery does not show up in the “Recent Deliveries” list on the settings–> Webhook area.

  2. The UI at project level does not get updated with the correct last updated time when the push took place?

Help will be greatly appreciated. I have been struggling with this windows installation for many hours now. Re-installed a couple of times now.


Almost everything about push depends on Git hooks to work. Have you installed git-bash on the server side?


I assume that git bash is intalled on the server - by right click and “Git Bash here” is displayed see image


Thanks for the update!

You may also want to log into log files see if any errors there (path_to_gogs/logs)


I have searched through the gogs.log file …there is nothing in there indicating any problems regarding the pre-receive hook declined error.

Anything else to look for?


Any error should not be missed, try repush and capture any new error log generated.


Hey There
Thanks for getting back to me. Below is my log file in c:\gogs\log\gogs.log
Below is the push using git bash and the error returned:
and below is the log file after the push:

I am struggling to find any more error information :frowning:


c:\gogs\log\hooks should have something as well.

Besides, are you running as service? If so, try start from a cli see if it still rejects.


The application never generates a log file in a folder called hooks…:frowning:

I am running the application as a service. I will have a look at starting the application from CLI


So I ran the gogs repository from a CLI and tried to push…still get the error
"Pushing master
Error: failed to push some refs to ‘http://dev01:8081/CorpsSecurity/CustomerPortal.git

Error encountered while pushing to the remote repository: rejected master -> master (pre-receive hook declined)"

and no hooks folder under the log folder


Which means the hook is failed to be called by Git at the first place. Is bash your default shell on your server? Do not use powershell.


I’m not sure there is an option to have a default shell settings on windows?


Hmm, I’m not sure, but someone on GitHub states he solves hook problem by not using PowerShell.