Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Dynabits opened this issue Oct 21, 2022 · 14 comments
Closed

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

Dynabits opened this issue Oct 21, 2022 · 14 comments
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail

Comments

@Dynabits
Copy link

Dynabits commented Oct 21, 2022

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

@lunny lunny added issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed type/bug labels Oct 21, 2022
@lunny
Copy link
Member

lunny commented Oct 21, 2022

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

@Dynabits
Copy link
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
Copy link
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
Copy link
Member

lunny commented Oct 21, 2022

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

@Dynabits
Copy link
Author

I added this line to /etc/hosts

127.0.0.1 localhost

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

@lunny lunny closed this as completed Oct 21, 2022
@codeex
Copy link

codeex commented Oct 31, 2022

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
Copy link
Member

lunny commented Oct 31, 2022

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

It's a domain problem.

@jackzhum
Copy link

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
Copy link

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
Copy link

jinyangcruise commented Jan 8, 2023

@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
Copy link

@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
Copy link
Contributor

zeripath commented Jan 16, 2023

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
Copy link

gilbertoca commented Jan 27, 2023

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
Copy link
Contributor

zeripath commented Jan 27, 2023

@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

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jan 27, 2023
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jan 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail
Projects
None yet
Development

No branches or pull requests

7 participants