go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
43.04k stars 5.32k forks source link

Repository default hook pre-receive.bak not able to resolve localhost #31304

Open Linkyrex opened 3 weeks ago

Linkyrex commented 3 weeks ago

Description

Having set LOCAL_ROOT_URL = http://localhost:3000/ in the app.ini will result in the error: "The change was rejected by the server. Please check Git Hooks. Full Rejection Message: Gitea: Internal Server Connection Error" when pushing to a repository. According to the logs the hook pre-receive.bak was declined. remote: Gitea: Internal Server Connection Error To /var/lib/gitea/data/gitea-repositories/org/myrepo.git ! [remote rejected] aae73a9fef44476b0666fff9f238472213057df7 -> main (pre-receive hook declined) error: failed to push some refs to '/var/lib/gitea/data/gitea-repositories/org/myrepo'

This Issue went away after setting: LOCAL_ROOT_URL = http://127.0.0.1:3000/

Gitea Version

1.22.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

CentOS9

How are you running Gitea?

Build from Source and as a service.

Database

PostgreSQL

lunny commented 3 weeks ago

Please test you can visit localhost from the shell of git.

Linkyrex commented 3 weeks ago

localhost itself resolved fine. Other aspects of Gitea were also working as expected. The issue seemed to be unique for the hook pre-receive.bak.

techknowlogick commented 3 weeks ago

The .bak is suspicious as by default hooks don't have that as an extension. I'm wondering if maybe someone edited a hook and made a backup and now it is still being run. Could you try removing that file from the hooks directory for that repo?