Description
Description
At random moments that we have been unable to clearly identify, like every couple of months, the post-checkout
, post-commit
, post-merge
and pre-push
LFS hooks reappear in a repository on the server. This has happened to several repositories, and multiple times to the same repository. The contents of the files are always the default LFS hooks, e.g. for 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 "$@"
This breaks all pull requests (as seen e.g. in #8646 (comment) or #13597 (comment) or #6460 (comment)). It seems #16372 also has an occurrence of these hooks appearing for seemingly no reason.
We have millions of lines of logs, with sensitive information even in repository names, so I will have trouble sharing full logs, but I can filter them if instructed on what could be relevant. Looking at the logs at the hook creation timestamp (in this case, 2022-05-25 17:31:19.279970086), nothing happens in the logs. Looking a few seconds after or before that, the only Git commands issued appear innocuous (cat-file
, show-ref
, upload-pack
, and log
).
I have seen that the ~git/.gitconfig
file may be relevant, so here it is:
[user]
name = Gitea
email = gitea@fake.local
[core]
quotepath = false
commitGraph = true
[credential]
helper = store
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[gc]
writeCommitGraph = true
[alias]
ll = log --oneline
[receive]
advertisePushOptions = true
procReceiveRefs = refs/for
Gitea Version
1.16.0+dev-350-ge11c19ed6
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
git version 2.35.1 — git-lfs/3.0.2 (GitHub; linux amd64; go 1.17.2)
Operating System
Debian GNU/Linux (sid)
How are you running Gitea?
- Gitea is built from source
- it has just one unrelated patch (changes in the password complexity)
- we run it under
systemd
- there is an Apache reverse proxy in front of Gitea
Database
PostgreSQL 14.1