Open na-Itms opened 2 months ago
It looks like the issue does not stem from PRs being "same-repository" PRs: I get the issue on all origin repos where a server-side custom hook is installed (in our case, under update.d
).
I edited the OP.
Did you mean a new hook file created under update.d
after a pull request created? Can you paste the content of this new-installed hook file?
Did you mean a new hook file created under
update.d
after a pull request created? Can you paste the content of this new-installed hook file?
Hello @lunny, no, the files that are created and cause the issue are the post-checkout
, post-commit
, post-merge
and pre-push
LFS hooks. However, I discovered that those are only created in the repos where we installed our own custom hooks under update.d
.
By typing this I think I know what the issue is. One of our update.d
hooks checks that no raw binary files were pushed by users who haven't installed git-lfs. This hook runs the git-lfs-fsck
command to verify the integrity of the LFS tracking. I believe this command is the one causing the LFS hooks to be recreated.
How should we move forward to avoid the batch request: missing protocol: ""
error?
We close issues that need feedback from the author if there were no new comments for a month. :tea:
Any news?
I haven't figured out how to reproduce it. What did you mean LFS hooks
?
Hi. I am not sure I understand what you are asking.
By LFS hooks I mean the default hooks post-checkout
, post-commit
, post-merge
and pre-push
. Just like in the other issues mentioned in the top post, the contents of these hooks are (for instance this is pre-push
):
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
git lfs pre-push "$@"
Loos like all these hooks are git client side hooks but not server side's. From Gitea side, it has itself git config and it will only have server-side hooks pre-receive
, update
, post-receive
and proc-receive
.
Description
This issue is similar to #19810 and #23765.
Whenever I try to create a PR from a branch on the same repository ("merge into repo:main / pull from repo:branch"), I receive the infamous error
batch request: missing protocol: ""
.The error is caused by Git LFS hooks getting installed on the repo server-side. Deleting them temporarily fixes the error and allows me to create the PR.
I noticed after a while that the issue arises as soon as the repo of the origin branch contains custom hooks (in our case, under
update.d
. Other repos do not face the issue.Additionally, as soon as the PR is created (from a branch suffering from the problem), the LFS hooks get recreated.
Gitea Version
1.22.1
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.43.5
Operating System
AlmaLinux 9
How are you running Gitea?
Install from binary, run with systemd
Database
MySQL/MariaDB