mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-12 02:24:21 -05:00
Gitea requires "exec" mounted repositories: Pushing to uninitialized repository on partition mounted with "noexec" silently fails #485
Closed
opened 2025-11-02 03:25:08 -06:00 by GiteaMirror
·
21 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.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rc3
v1.4.0-rc2
v1.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
No Label
topic/deployment
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#485
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pmattern on GitHub (Mar 12, 2017).
f0efb615[x]):Description
When the Git repositories handled by a Gitea instance happen to reside on a partition which is mounted with
noexecset and a repository is not initialized upon creation from the Web-UI ("Initialize this repository with selected files and template" unchecked), the usualgit push -uto populate the repository silently fails. That is, everything is fine according to the command line, but the repository remains empty in Gitea's Web-UI.The problem is not that straight-forward to understand as the Gitea logs do not provide any hint.
To reproduce install current Gitea from scratch making sure the Git repositories in terms of
[repository] - ROOTofapp.iniare on a partition which is mounted withnoexecset, have an arbitrary user create an uninitialized repository from within Gitea and have him populate that repository by runninggit push -ufrom CLI as usual.Optionally repeat these steps after remounting the partition with
execset.@pgaskin commented on GitHub (Mar 12, 2017):
Is the log level set to Trace?
@pmattern commented on GitHub (Mar 12, 2017):
Yes. Still there are only messages like
in
gitea.logwhile no error messages can be seen in the rather verbosexorm.log.@pgaskin commented on GitHub (Mar 12, 2017):
Can you strace gitea and post the output?
strace -o strace_gitea.out gitea web@pmattern commented on GitHub (Mar 14, 2017):
I ran strace but I fear it is of no use either. All entries are dealing with launch and shutdown only, all parts in between including pushing to the repository are missing completely.
As a side-effect the problem does not exist when Gitea is run as root (
sudo strace -o /usr/share/gitea/log/strace.log /usr/share/gitea/gitea web), while it could be seen when it was run as the regular Git user via strace (sudo -u git strace -t -o /usr/share/gitea/log/strace.log /usr/share/gitea/gitea web) as well.Current tests performed with
8746fb33.@andreipoe commented on GitHub (May 28, 2017):
Hi,
I'm experiencing the same issue with Gitea 1.1.1 running in Docker on AArch64. I wanted to add that pulling from such a repository is fine, the code is just not displayed in the web UI as if the repo was empty.
@bkcsoft commented on GitHub (Jun 15, 2017):
The git-hooks required to update the DB can't be executed (
noexec...) hence they fail. One possible solution would be to just have the hooks as symlinks to a gitea-directory. And have a pre-flight check when creating the repo that we can infact execute stuff in there.@Ulrar commented on GitHub (Jul 25, 2018):
So, how do we work around this in the meantime ? Where is the directory containing those hooks we'd need to move to a different partition ?
@lafriks commented on GitHub (Jul 25, 2018):
@Ulrar you can not use partition with noexec partition to store git repositories
@Ulrar commented on GitHub (Jul 25, 2018):
You very much can, it works fine. The only issue is that hook, which should be solved by moving it to a different partition with exec enabled and symlinking it to it's old location. That's what I do with payment binaries for websites, and it works fine, no reason it wouldn't with git
@lafriks commented on GitHub (Jul 25, 2018):
@Ulrar git (independently of gitea) does not support storing hooks outside of repository folder and are stored in
.git/hooksdirectory@bkcsoft commented on GitHub (Jul 26, 2018):
https://git-scm.com/docs/githooks#_description
This would have to inject
[]string{"-c", "core.hooksPath=/path/to/gitea/lib/hooks/"}🤔7a30208e05/cmd/serv.go (L305-L311)@stale[bot] commented on GitHub (Jan 16, 2019):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
@stale[bot] commented on GitHub (Feb 19, 2019):
This issue has been automatically closed because of inactivity. You can re-open it if needed.
@lesderid commented on GitHub (Jun 14, 2019):
Was this fixed? If not, it should be. This is a valid bug and some security standards/guidelines could require user data being on a
noexecmount.(I have wasted many an hour on trying to debug why some software doesn't work, finally figuring out that it's (silently) failing on a
noexecmount. If you don't want to support it, at least give the user an actionable error message.)@Ulrar commented on GitHub (Jun 14, 2019):
Not that I'm aware of, unfortunately. We just change the flag in the SQLite
manually after the first push, as far as I can tell everything works fine
on a noexec partition except that very specific thing.
On Fri, Jun 14, 2019, 12:32 Les De Ridder notifications@github.com wrote:
@zeripath commented on GitHub (Jun 15, 2019):
Hmm... so I have an idea for how to go about ameliorating this.
I think setting https://git-scm.com/docs/git-config#Documentation/git-config.txt-corehooksPath in the gitea user .gitconfig would allow you to change the location of the git hooks for all repos.
You'd lose per repository git hooks but you should be able to set this up correctly so that gitea hooks can be run.
I think through clever use of this you could actually workaround the noexec problem entirely.
Now we could add a gitea workaround based on this - but it may be quite complex and I would have to think about how to make it work.
@lunny commented on GitHub (Oct 15, 2020):
If this is a deployment problem, I think we can close this.
@lesderid commented on GitHub (Dec 9, 2020):
@techknowlogick Was this fixed?
@techknowlogick commented on GitHub (Dec 9, 2020):
It's not a bug, we need to be able to execute git hooks.
@Ulrar commented on GitHub (Dec 9, 2020):
It's not a bug but an option to specify a different path for hooks would be
a nice fix imho
On Wed 9 Dec 2020, 03:05 techknowlogick, notifications@github.com wrote:
@zeripath commented on GitHub (Dec 9, 2020):
Undoubtedly something could be done using the config value
core.hookspathhttps://git-scm.com/docs/git-config#Documentation/git-config.txt-corehooksPath and by makinggitea hook pre-receive&gitea hook post-receiveexecute any hooks directly inpre-receive.d/post-receive.d/folders. (gitea hook updatecould be included here but I think we should stop providing this expensive and poorly implemented hook.) There may yet be potential difficulties with such an approach but I think it should be possible.I would however say this is not a high priority - even though if implemented correctly it could be a considered a security improvement as the security benefits would be somewhat minor.
If you are desperate for this functionality and cannot provide a PR, you could either provide a bounty for the feature, or try contacting one of the maintainers - myself included - on discord directly asking one of us to implement it as a paid feature. I will likely get round to trying the approach listed above at some point but I'm quite busy on other things at present.