mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-11 17:46:29 -05:00
Clone new project works, pushing commits fails with internal error #6440
Closed
opened 2025-11-02 06:56:01 -06:00 by GiteaMirror
·
20 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.5
v1.16.4
v1.16.3
v1.16.2
v1.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.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
issue/needs-feedback
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#6440
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 @LordOfDragons on GitHub (Dec 3, 2020).
Gitea runs behind reverse proxy as outlined in https://docs.gitea.io/en-us/reverse-proxies/ .
Apache ssl_access.log
Gitea.log
Gitea.err => empty file
Apache configuration (relevant part):
Description
Installed Gitea behind Apache reverse proxy as sub-path on domain. Web interface is running correctly. Created test repository with LFS support. On client checked out repository which is working correctly (using https:// URL). Added two test files and commit. Push is not working. Produces this error:
Repository is correctly created on server. Apache also correctly forwards the request but Gitea fails to answer it. As mentioned, Web-Access works (so HTTPS forwarding does work) but GIT push does not.
@LordOfDragons commented on GitHub (Dec 8, 2020):
Also here the directory listing of the repository created by Gitea:
As you can see "git-receive-pack" as requested by the git client is not present in this directory. Does Gitea fail to create this file?
@LordOfDragons commented on GitHub (Dec 8, 2020):
I also tried using the SSH protocol instead of HTTPS and the result is the same. Something is not working on the Gitea side but I'm out of ideas what.
@LordOfDragons commented on GitHub (Dec 9, 2020):
I've tried now to clone the repository directly on the server using direct access to Gitea without going through Apache reverse proxy. The result is the same:
The gitea.log file contains nothing. Something inside Gite is going horribly wrong. Especially without any logs I get nowhere.
@techknowlogick commented on GitHub (Dec 9, 2020):
I see that the repo name is
lfstestare you pushing any LFS files as well?Are you able to upgrade to latest stable version of Gitea (1.13.0)?
Did you initialize the repo via Gitea web interface, or is the repo initialized via your local computer?
Can you create another test repo to see if you can replicate there (as it could be that there is an issue with git hooks with your first repo)?
@LordOfDragons commented on GitHub (Dec 9, 2020):
3b) I tried now cloning the repo, calling "git init", commit a file and pushing. Still failing with the same error.
Web Interface Git Init Problem
Results in the following error:
A directory "gitea-testrepo981834641" does not exist in /tmp . /tmp is owned root:root with permission drwxrwxrwt. Maybe Gitea does not use a correct way to access tmp-files? Can this path be specified to avoid problems?
EDIT: gitea.log contains something for the first time
EDIT EDIT: I don't know if this has an influence on /tmp but I'm running a hardened kernel on the server.
EDIT EDIT EDIT: I cloned the git repo as regular user into /tmp which is working. Gitea has to do something wrong to get permission denied where I as regular user do not get it.
EDIT EDIT EDIT EDIT: I sudo-ed into the "git" user, which is what Gitea is running as and did the same cloing into /tmp as in the editor above. This is working so it is not a user permission problem but has to be a coding problem somehow.
@lunny commented on GitHub (Dec 9, 2020):
@LordOfDragons Is it work to just push to Gitea server but not with Apache so that we can know if it's a problem related apache configuration or Gitea itself.
Gitea should be run in user git so if it visit a path root owned, it may return permission denied.
@LordOfDragons commented on GitHub (Dec 9, 2020):
@lunny As mentioned above I also tried on the server itself going directly to localhost:3000 but the result is the same. Under Gentoo Gitea runs as user git as far as I can see. I tried accessing /tmp using the git user and this works so it should not be a permission problem pertinent to the user.
To be on the safe side I tried right now cloning from localhost:3000 using git user into /tmp . This works. when I go into "lfstest" directory and call "git init" it tells me it "re-initialized" the repository.
@LordOfDragons commented on GitHub (Dec 16, 2020):
Any news on the issue? This issues is a hard road block to use Gitea.
@lunny commented on GitHub (Dec 16, 2020):
From the log it's obvious that it's a folder permission problem about /tmp. what's the file mode of /tmp ?
@LordOfDragons commented on GitHub (Dec 16, 2020):
Output from "ls -a /tmp".
As mentioned above if I su into "git" user I can clone git into "/tmp" and call "git init" without problem. So it can not be a permission problem on "/tmp".
@lunny commented on GitHub (Dec 17, 2020):
@LordOfDragons Could you try to open
/tmp/gitea-testrepo981834641/.git/configand check the file/dir mode when the error is reproducing?@zeripath commented on GitHub (Dec 17, 2020):
That's not true.
Just because an interactive user can sudo as another user from a shell and run things from that sudo'd shell fine does not mean that the gitea process is able to.
You do not say how you are running gitea - but from what you are saying I do not believe that you are running it from an interactive user's shell, (and you shouldn't have to.)
Check your privileges.
I cannot be more explicit as to how to go about that because privilege granting and mapping is somewhat black magic and I find them poorly documented in general, but I would not be surprised if you setup was such that child processes might not be allowed access to tmp from other processes or something like that.
Consider running Gitea with a different environment set TMPDIR which may not have the same permissions/privilege protection.
@zeripath commented on GitHub (Dec 17, 2020):
For an example of another unique situation that was caused by a hardened system see #9792
In that case the systemd capabilities and privileges were set up in such a way that if a service or process asked to do something they were not allowed to, instead of receiving an EPERM - they would simply die.
Let me just demonstrate how appalling and impossible to debug that could be - a process that just wants to check if stdin is a tty in order to see if they're running in an interactive manner, would, if they didn't have permission to read the tty just die. That means that calls to
catjust died - immediately and without any information being returned.No-one could figure out what was happening - it was like files just didn't exist. Who would ever consider that
catwould fail.@LordOfDragons commented on GitHub (Dec 17, 2020):
I tried it and the directory named in the 500 error page ( /tmp/gitea-testrepo981834641/.git/config ) does not exist. Hence the directory itself can not be created.
@LordOfDragons commented on GitHub (Dec 17, 2020):
I said "su" not "sudo". Not quite the same but I get your concern there. Personally I have no objection against making gittea use a different tmp directory but this init problem here is not the initial problem why I created the issue in the first place. The initial problem is that gittea did allow clone but not push to a directory owned by the same user gittea is running as.
That said I did another check to verify something. The running process is listed like this:
The app.ini states to use RUN_USER=git . So far this is fine. I have though noticed something which I missed so far. This is the permission listing of the git repository directory:
This is actually quite interesting. This combination of user/group/permission is strange. It means Gittea web interface somehow managed to create a repository directory with permission 755 with root:git . Actually the entire directories and files underneath do not have group write permission.
What exactly is going wrong here? Does Gittea assign the wrong permissions (maybe wrong umask)? Did Gitea not properly drop priviledges to access the file system?
Knowing a bit more on how Gittea creates repositories could help figure out the appropriate cure for this. I don't want to just chown around in the repositories just to have Gitea ending up the wrong way the next time something is commited.
@LordOfDragons commented on GitHub (Dec 17, 2020):
This is the init script running gitea. I see nothing wrong here:
@LordOfDragons commented on GitHub (Dec 17, 2020):
I've found the following bug report: https://bugs.gentoo.org/750218
The finding in this bug report is that Gitea is installed owned by "root" with the suid flag set. It is questioned why this is the case and if it is intended or not. I'll try the mentioned fix to see if I get past my problems.
@zeripath commented on GitHub (Dec 17, 2020):
ugh. Gitea should not need SUID.
@LordOfDragons commented on GitHub (Dec 17, 2020):
The fix from the bug report helps with both issues. Pushing is now working and creating a new repository with initial init is also working now.
So the problem is the wrong user and suid on installing gitea.
@zeripath commented on GitHub (Dec 17, 2020):
OK looks like we can close this issue.