Skip to content

[remote rejected] main -> main (pre-receive hook declined) #21528

@Dynabits

Description

@Dynabits

Description

Git push always fails with error:

git push origin main
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 209 bytes | 209.00 KiB/s, done.
Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
remote:
remote: Gitea: Internal Server Error
To http://192.168.1.99:3000/user/test.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'http://192.168.1.99:3000/user/test.git'

Gitea Version

Gitea version 1.17.3+4-g19df07f02 built with GNU Make 4.1, go1.18.7 : bindata, sqlite, sqlite_unlock_notify

Git Version

2.37.3

Operating System

Arch Linux

How are you running Gitea?

Binary download, fresh install, no containers.

Database

SQLite

Activity

added
issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detail
and removed on Oct 21, 2022
lunny

lunny commented on Oct 21, 2022

@lunny
Member

You can enable RUN_MODE as dev and try again to take a look at what's the error.

Dynabits

Dynabits commented on Oct 21, 2022

@Dynabits
Author

Output with RUN_MODE set to dev

git push origin main
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 209 bytes | 209.00 KiB/s, done.
Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
remote:
remote: Gitea: Internal Server Error
remote: Unable to contact gitea: Post "http://localhost:3000/api/internal/hook/pre-receive/user/test": dial tcp: lookup localhost on 1.1.1.1:53: no such host
To http://192.168.1.99:3000/user/test.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'http://192.168.1.99:3000/user/test.git'
Dynabits

Dynabits commented on Oct 21, 2022

@Dynabits
Author

Ahh I see, looks like a post request is made with localost in the URL, that should be the IP address, not sure how to fix though.

lunny

lunny commented on Oct 21, 2022

@lunny
Member

Because the host don't know what localhost means. Your /etc/hosts should be checked.

Dynabits

Dynabits commented on Oct 21, 2022

@Dynabits
Author

I added this line to /etc/hosts

127.0.0.1 localhost

Works like a charm now, thank you so much @lunny

codeex

codeex commented on Oct 31, 2022

@codeex

on windows platform, it has the same error :Gitea: Internal Server Error
Unable to contact gitea: Post "http://localhost:3000/api/internal/hook/pre-receive/hhh/test": dial tcp: lookup localhost on 114.114.114.114:53: no such host.

I've modified C:\Windows\System32\drivers\etc\hosts, and added
127.0.0.1 localhost
but it has the same error, I don't know what I do again?

lunny

lunny commented on Oct 31, 2022

@lunny
Member
dial tcp: lookup localhost on 114.114.114.114:53: no such host.

It's a domain problem.

jackzhum

jackzhum commented on Nov 14, 2022

@jackzhum
dial tcp: lookup localhost on 114.114.114.114:53: no such host.

It's a domain problem.

I have the same problem. How can I solve it?

jackzhum

jackzhum commented on Nov 14, 2022

@jackzhum
dial tcp: lookup localhost on 114.114.114.114:53: no such host.

It's a domain problem.

I have the same problem. How can I solve it?

I solved this problem: I will LOCAL_ ROOT_ The URL is changed to be the same as ROOT_ URL consistency.

jinyangcruise

jinyangcruise commented on Jan 8, 2023

@jinyangcruise

@jackzhum

dial tcp: lookup localhost on 114.114.114.114:53: no such host.

It's a domain problem.

I have the same problem. How can I solve it?

I solved this problem: I will LOCAL_ ROOT_ The URL is changed to be the same as ROOT_ URL consistency.

I have the same problem. what is "LOCAL_ ROOT_ "? I can not find a LOCAL_ in my app.ini.
here is my my app.ini content:

APP_NAME = Gitea: Git with a cup of tea
RUN_USER = Administrator
RUN_MODE = dev

[database]
DB_TYPE  = sqlite3
HOST     = 127.0.0.1:3306
NAME     = gitea
USER     = gitea
PASSWD   = 
SCHEMA   = 
SSL_MODE = disable
CHARSET  = utf8
PATH     = D:\Program Files\Gitea\data\gitea.db
LOG_SQL  = false

[repository]
ROOT = D:/Program Files/Gitea/data/gitea-repositories

[server]
SSH_DOMAIN       = localhost
DOMAIN           = localhost
HTTP_PORT        = 3000
ROOT_URL         = http://localhost:3000/
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_JWT_SECRET   = clQ9TFYBIEYvXxNMoS8wQGZtKSHEGQiyK-92TeM7pjM
OFFLINE_MODE     = false

[lfs]
PATH = D:/Program Files/Gitea/data/lfs

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
DISABLE_REGISTRATION              = false
ALLOW_ONLY_EXTERNAL_REGISTRATION  = false
ENABLE_CAPTCHA                    = false
REQUIRE_SIGNIN_VIEW               = false
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = noreply.localhost

[picture]
ENABLE_FEDERATED_AVATAR = false

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[session]
PROVIDER = file

[log]
MODE      = console
LEVEL     = info
ROOT_PATH = D:/Program Files/Gitea/log
ROUTER    = console

[repository.pull-request]
DEFAULT_MERGE_STYLE = merge

[repository.signing]
DEFAULT_TRUST_MODEL = committer

[security]
INSTALL_LOCK       = true
INTERNAL_TOKEN     = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2NzMxNjUzMDB9.v6dxMxoc0adzKb6CDhHKErdRRTmCePx-Wc6epXht3is
PASSWORD_HASH_ALGO = pbkdf2
jackzhum

jackzhum commented on Jan 16, 2023

@jackzhum

@jackzhum

dial tcp: lookup localhost on 114.114.114.114:53: no such host.

It's a domain problem.

I have the same problem. How can I solve it?

I solved this problem: I will LOCAL_ ROOT_ The URL is changed to be the same as ROOT_ URL consistency.

I have the same problem. what is "LOCAL_ ROOT_ "? I can not find a LOCAL_ in my app.ini. here is my my app.ini content:

APP_NAME = Gitea: Git with a cup of tea
RUN_USER = Administrator
RUN_MODE = dev

[database]
DB_TYPE  = sqlite3
HOST     = 127.0.0.1:3306
NAME     = gitea
USER     = gitea
PASSWD   = 
SCHEMA   = 
SSL_MODE = disable
CHARSET  = utf8
PATH     = D:\Program Files\Gitea\data\gitea.db
LOG_SQL  = false

[repository]
ROOT = D:/Program Files/Gitea/data/gitea-repositories

[server]
SSH_DOMAIN       = localhost
DOMAIN           = localhost
HTTP_PORT        = 3000
ROOT_URL         = http://localhost:3000/
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_JWT_SECRET   = clQ9TFYBIEYvXxNMoS8wQGZtKSHEGQiyK-92TeM7pjM
OFFLINE_MODE     = false

[lfs]
PATH = D:/Program Files/Gitea/data/lfs

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
DISABLE_REGISTRATION              = false
ALLOW_ONLY_EXTERNAL_REGISTRATION  = false
ENABLE_CAPTCHA                    = false
REQUIRE_SIGNIN_VIEW               = false
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = noreply.localhost

[picture]
ENABLE_FEDERATED_AVATAR = false

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[session]
PROVIDER = file

[log]
MODE      = console
LEVEL     = info
ROOT_PATH = D:/Program Files/Gitea/log
ROUTER    = console

[repository.pull-request]
DEFAULT_MERGE_STYLE = merge

[repository.signing]
DEFAULT_TRUST_MODEL = committer

[security]
INSTALL_LOCK       = true
INTERNAL_TOKEN     = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2NzMxNjUzMDB9.v6dxMxoc0adzKb6CDhHKErdRRTmCePx-Wc6epXht3is
PASSWORD_HASH_ALGO = pbkdf2

https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini
image

zeripath

zeripath commented on Jan 16, 2023

@zeripath
Contributor

THOSE EXPERIENCING THIS ON WINDOWS IN 1.18 - YOU ARE EXPERIENCING A DUPLICATE OF #22370

Please see #22370 (comment)

DESCRIPTION

This bug is due to a change in Go's handling of the netgo build tag for Windows see:

#22370 (comment)

We were bitten by this because we build our static precompiled binaries with netgo for all platforms. (see #22370 (comment))

#22467 and #22468 should fix this for 1.18.1 and 1.19-dev.

WORKAROUND

For 1.18.0 set the GODEBUG=netdns=cgo environment variable when running gitea and/or update your LOCAL_ROOT_URL to use an IP address

#22370 (comment)


Builds of what will become 1.18.1 are available now on https://dl.gitea.io/gitea/1.18

gilbertoca

gilbertoca commented on Jan 27, 2023

@gilbertoca

In our case, bringing our server from gitea-1.16.9-linux-amd64 to gitea-1.17.4-linux-amd64, we needed to remove that parameter:

#LOCAL_ROOT_URL = https://localhost:3000/

Maybe is not just a windows problem? @zeripath

zeripath

zeripath commented on Jan 27, 2023

@zeripath
Contributor

@gilbertoca on 1.18 this bug was one of a cluster of issues opened due to a change in the way Golang handles the build tag netgo in Golang 1.18. This broke IP lookup of localhost.

Whatever issue you were experiencing is different and if you're still experiencing you should consider opening a separate bug report with complete information about what your experience is. However, 1.17 is now out of support so you would need to show that your problem existed on 1.18 too. On 1.17 as was originally experienced this was due to missing alias for 127.0.0.1 in /etc/hosts.

The other thing to note - is that your problem was solved by doing the opposite to how this bug was worked around for others. That your solution requires the opposite says that the problem is likely a different thing.

In any case I'm going to lock this conversation - this bug is resolved and was a duplicate of #22730

locked as resolved and limited conversation to collaborators on Jan 27, 2023
locked as resolved and limited conversation to collaborators on Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detail

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lunny@zeripath@gilbertoca@codeex@jackzhum

        Issue actions

          [remote rejected] main -> main (pre-receive hook declined) · Issue #21528 · go-gitea/gitea