push fail (pre-receive hook declined) #693

Closed
opened 2025-11-02 03:33:22 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @ncwgf on GitHub (May 5, 2017).

Originally assigned to: @lunny on GitHub.

  • Gitea version (or commit ref): a503947 9a0b0da latest docker image
  • Git version:
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

when git push origin :refs/heads/feature/<xxx> (deleting branch), push fail
! [remote rejected] feature/<xxx> (pre-receive hook declined)
/data/gitea/log/hooks/pre-receive.log
[...io/gitea/cmd/hook.go:126 runHookPreReceive()] [F] retrieve protected branches information failed

seem only feature branch have this problem
develop branch work fine
guess related to branch name with /

rollback to image/version v1.1.1 will work

also change default branch and set protected branch is not work, even in v1.1.1, not sure is it same reason

Originally created by @ncwgf on GitHub (May 5, 2017). Originally assigned to: @lunny on GitHub. - Gitea version (or commit ref): a503947 9a0b0da latest docker image - Git version: - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description when `git push origin :refs/heads/feature/<xxx>` (deleting branch), push fail ` ! [remote rejected] feature/<xxx> (pre-receive hook declined)` /data/gitea/log/hooks/pre-receive.log `[...io/gitea/cmd/hook.go:126 runHookPreReceive()] [F] retrieve protected branches information failed` > seem only feature branch have this problem > develop branch work fine > guess related to branch name with `/` rollback to image/version v1.1.1 will work also change default branch and set protected branch is not work, even in v1.1.1, not sure is it same reason
GiteaMirror added the type/bug label 2025-11-02 03:33:22 -06:00
Author
Owner

@SEQUOIIA commented on GitHub (May 5, 2017):

Just ran into the same issue with a branch that also contains '/' in its name.

@SEQUOIIA commented on GitHub (May 5, 2017): Just ran into the same issue with a branch that also contains '/' in its name.
Author
Owner

@silverwind commented on GitHub (May 5, 2017):

Also getting this, my target branch is just master.

@silverwind commented on GitHub (May 5, 2017): Also getting this, my target branch is just `master`.
Author
Owner

@lunny commented on GitHub (May 8, 2017):

@silverwind maybe your problem is not the same as this issue.

@lunny commented on GitHub (May 8, 2017): @silverwind maybe your problem is not the same as this issue.
Author
Owner

@silverwind commented on GitHub (May 8, 2017):

@lunny no, I guess it must've been the same issue as it works again as of 2bb8b3a562, and I don't have any local branches containing a / either.

@silverwind commented on GitHub (May 8, 2017): @lunny no, I guess it must've been the same issue as it works again as of https://github.com/go-gitea/gitea/commit/2bb8b3a56219f3fcba7c77c7a8fc10769b8c11bd, and I don't have any local branches containing a `/` either.
Author
Owner

@davydov-vyacheslav commented on GitHub (Aug 28, 2017):

After upgrading from 1.1.0 to 1.2.0-rc1 I start getting such errors. After Taking a look at pre-receive.log I found one interesting thing:
In the logs: [T] GetProtectedBranchBy: http://[domain]:7443/api/internal/branch/2/master
but actual thing is that I have apache reverse proxy (according to my home ASUS router settings), which make transforms this url to https://[domain]:39443/api/internal/branch/2/master ....

Is there a place in conf files where I can configure the link?

P.S.
My Server's conf is

[server]
PROTOCOL = http
DOMAIN = [domain]
ROOT_URL = https://[domain]:39443/
HTTP_ADDR = 0.0.0.0
HTTP_PORT = 7443
UNIX_SOCKET_PERMISSION = 666
LOCAL_ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
DISABLE_SSH = true
START_SSH_SERVER = false
OFFLINE_MODE = false
DISABLE_ROUTER_LOG = false

@davydov-vyacheslav commented on GitHub (Aug 28, 2017): After upgrading from 1.1.0 to 1.2.0-rc1 I start getting such errors. After Taking a look at pre-receive.log I found one interesting thing: In the logs: [T] GetProtectedBranchBy: http://[domain]:7443/api/internal/branch/2/master but actual thing is that I have apache reverse proxy (according to my home ASUS router settings), which make transforms this url to https://[domain]:39443/api/internal/branch/2/master .... Is there a place in conf files where I can configure the link? P.S. My Server's conf is [server] PROTOCOL = http DOMAIN = [domain] ROOT_URL = https://[domain]:39443/ HTTP_ADDR = 0.0.0.0 HTTP_PORT = 7443 UNIX_SOCKET_PERMISSION = 666 LOCAL_ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/ DISABLE_SSH = true START_SSH_SERVER = false OFFLINE_MODE = false DISABLE_ROUTER_LOG = false
Author
Owner

@davydov-vyacheslav commented on GitHub (Aug 28, 2017):

Sorry for flood.. managed to fix it by set DOMAIN = localhost ... Not sure that this is correct way ... but it works

@davydov-vyacheslav commented on GitHub (Aug 28, 2017): Sorry for flood.. managed to fix it by set DOMAIN = localhost ... Not sure that this is correct way ... but it works
Author
Owner

@lafriks commented on GitHub (Aug 28, 2017):

@davydov-vyacheslav it could also be fixed by changing LOCAL_ROOT_URL to http://localhost:7443/

@lafriks commented on GitHub (Aug 28, 2017): @davydov-vyacheslav it could also be fixed by changing `LOCAL_ROOT_URL` to `http://localhost:7443/`
Author
Owner

@davydov-vyacheslav commented on GitHub (Aug 28, 2017):

@lafriks , thank you!

@davydov-vyacheslav commented on GitHub (Aug 28, 2017): @lafriks , thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#693