Skip to content

(pre-receive hook declined) error on windows #22381

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

Closed
sinotaotao opened this issue Jan 9, 2023 · 9 comments
Closed

(pre-receive hook declined) error on windows #22381

sinotaotao opened this issue Jan 9, 2023 · 9 comments
Labels
issue/duplicate The issue has already been reported.

Comments

@sinotaotao
Copy link

sinotaotao commented Jan 9, 2023

On windows7. There is a main (pre-receive hook declined) error on my PC.
Both git cli and browser pushes were refused. Currently I go back to use v1.17.4.

The Gitea version is 1.18.0, but v1.18.0 on linux x86_64 is ok.

Logs when the (pre-receive hook declined) error occurred:

2023/01/07 12:09:41 ...y/files/temp_repo.go:314:Push() [I] [63b8f033] Unable to push back to repo from temporary repo due to rejection: Other/Go (D:/gitea/data/tmp/local-repo\upload.git2949402268)
	Stdout: 
	Stderr: remote: 
	remote: Gitea: Internal Server Error        
	remote: * Checking 1 references        
	To D:\gitea\data\gitea-repositories\other\go.git
	 ! [remote rejected] cb0e2ba9efbc8f5fa984a61aebee5781a0d81b83 -> main (pre-receive hook declined)
	error: failed to push some refs to 'D:\gitea\data\gitea-repositories\other\go.git'
	
	Error: exit status 1
2023/01/07 12:09:41 ...tory/files/update.go:448:CreateOrUpdateRepoFile() [E] [63b8f033] *log.ColoredValue PushRejected Error: exit status 1: remote: 
	remote: Gitea: Internal Server Error        
	remote: * Checking 1 references        
	To D:\gitea\data\gitea-repositories\other\go.git
	 ! [remote rejected] cb0e2ba9efbc8f5fa984a61aebee5781a0d81b83 -> main (pre-receive hook declined)
	error: failed to push some refs to 'D:\gitea\data\gitea-repositories\other\go.git'
	
	
2023/01/07 12:09:41 ...y/files/temp_repo.go:50:Close() [E] [63b8f033] Failed to remove temporary path D:/gitea/data/tmp/local-repo\upload.git2949402268: remove D:/gitea/data/tmp/local-repo\upload.git2949402268: The process cannot access the file because it is being used by another process.

Originally posted by @sinotaotao in #22293 (comment)

@sinotaotao
Copy link
Author

sinotaotao commented Jan 9, 2023

With a clean reinstall operation can reproduce this error on my VM (win7-x64), even the new project only has a file readme.md and made a small change cannot push to server side.

@techknowlogick
Copy link
Member

@sinotaotao are you able to try with gogit version of the windows binary?

@zeripath
Copy link
Contributor

zeripath commented Jan 9, 2023

remote: Gitea: Internal Server Error

Please look at the logs for the Gitea server which should help further explain what the error is.

@emehmet
Copy link

emehmet commented Jan 10, 2023

same error +

@sinotaotao
Copy link
Author

sinotaotao commented Jan 10, 2023

@sinotaotao are you able to try with gogit version of the windows binary?
@techknowlogick
git push refused too, error is Gitea: Internal Server Error ... pleae check hooks, but after recreation of hooks, or create a new test repo, every push was refused.

@sinotaotao
Copy link
Author

sinotaotao commented Jan 10, 2023

@zeripath About logs

The logs in the first post are from server side. When the (pre-receive hook declined) error occurred, there was a empty foler like D:/gitea/data/tmp/local-repo\upload.git2949402268, which was deleted when gitea binary restarted

@zeripath
Copy link
Contributor

zeripath commented Jan 10, 2023

First off I suspect this is going to have the same underlying issue as in #22370 and in #22293 so I'm explicitly mentioning them here. It may be simply that adding the following setting to the app.ini [server] section will fix this:

[server]
LOCAL_ROOT_URL = http://127.0.0.1:3000/
...

@zeripath About logs

The logs in the first post are from server side. When the (pre-receive hook declined) error occurred, there was a empty foler like D:/gitea/data/tmp/local-repo\upload.git2949402268, which was deleted when gitea binary restarted

You have not given us all the logs that we need. You have not turned on DEBUG logging and not given us the router logs.

I know that you've not given me all of the logs because there will be at least one call to /api/internal that is not in the logs. If you have turned on DEBUG logging there will be some logging before the log line that you have pasted.

I shouldn't have to keep saying this, PLEASE READ https://docs.gitea.io/en-us/logging-configuration/#debugging-problems

@sinotaotao
Copy link
Author

sinotaotao commented Jan 10, 2023

Add the config item

[server]
LOCAL_ROOT_URL = http://127.0.0.1:3000/

solved the problem

thanks very much @zeripath @techknowlogick

@zeripath
Copy link
Contributor

Duplicate of #22370.

Users affected should set LOCAL_ROOT_URL as their hosts file most likely doesn't contain a valid alias for localhost. I don't understand why go has suddenly broke this but it's not our fault - we'll investigate more in the other issue.

@zeripath zeripath added the issue/duplicate The issue has already been reported. label Jan 11, 2023
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/duplicate The issue has already been reported.
Projects
None yet
Development

No branches or pull requests

4 participants