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
44.6k stars 5.45k forks source link

! [remote rejected] master -> master (pre-receive hook declined) #7284

Closed JKingweb closed 5 years ago

JKingweb commented 5 years ago
[Macaron] 2019-06-23 19:28:11: Started GET /MensBeam/arsse.git/info/refs?service=git-upload-pack for 127.0.0.1
[Macaron] 2019-06-23 19:28:11: Completed GET /MensBeam/arsse.git/info/refs?service=git-upload-pack 200 OK in 9.169103ms
[Macaron] 2019-06-23 19:28:11: Started GET /MensBeam/arsse.git/info/refs?service=git-receive-pack for 127.0.0.1
[Macaron] 2019-06-23 19:28:11: Completed GET /MensBeam/arsse.git/info/refs?service=git-receive-pack 401 Unauthorized in 1.825858ms
[Macaron] 2019-06-23 19:28:11: Started GET /MensBeam/arsse.git/info/refs?service=git-receive-pack for 127.0.0.1
[Macaron] 2019-06-23 19:28:12: Completed GET /MensBeam/arsse.git/info/refs?service=git-receive-pack 200 OK in 446.823637ms
[Macaron] 2019-06-23 19:28:12: Started POST /MensBeam/arsse.git/git-receive-pack for 127.0.0.1
[Macaron] 2019-06-23 19:28:13: Completed POST /MensBeam/arsse.git/git-receive-pack 200 OK in 563.953235ms

Description

I know this issue has cropped up a lot for people, but none of the supposed solutions have worked for me.

Relevant configuration as follows:

[server]
ROOT_URL         = https://code.mensbeam.com:443/
PROTOCOL         = http
HTTP_ADDR        = 127.0.0.1
DOMAIN           = localhost
HTTP_PORT        = 3000

And for Nginx:

server {
    server_name code.mensbeam.com;
    ... boilerplate stuff ...

    location / {
        proxy_buffering off;
        proxy_set_header Host $http_host;
        proxy_set_header X-WEBAUTH-USER $remote_user;
        proxy_pass http://localhost:3000;
    }
}

I've tried numerous variations on the above Gitea configuration (no HTTP_ADDR, DOMAIN set to code.mensbeam.com, no port in ROOT_URL...), but nothing works. This was all working earlier today, and had been for a couple of years, so I'm pretty mystified.

JKingweb commented 5 years ago

Resynchronizing hooks seems to have put things right. Sorry for the noise.

4oo4 commented 5 years ago

@JKingweb So did you run gitea admin regenerate hooks? I tried that but it didn't seem to help.

JKingweb commented 5 years ago

I used the Web interface. I wasn't aware there was a CLI command.

4oo4 commented 5 years ago

I'm not sure if it's the same thing? I ran that too from the web interface, but looks like my issue is an artifact that was leftover from migrating it from Gogs, correcting the path here solved it:

git@gitea:~/gitea-repositories/user/arduino-code.git/hooks/pre-receive.d$ cat pre-receive
#!/usr/bin/env bash
"/home/git/gogs/gogs" hook --config='/home/git/gogs/custom/conf/app.ini' pre-receive

Not sure why it got hung up now, since I successfully pushed to it yesterday without any issues. :man_shrugging: Looks to be a change in behavior with 1.9.1: https://github.com/go-gitea/gitea/pull/7856, https://github.com/go-gitea/gitea/issues/7754

For anyone else in the same situation, running this from the gitea-repositories directory is a quick fix: grep -lr 'gogs/gogs' * | xargs sed -i 's/gogs/gitea/g;'