Problem starting up gitea as user git #5478

Closed
opened 2025-11-02 06:25:58 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @Jackysi on GitHub (May 31, 2020).

  • Gitea version (or commit ref): Gitea version 1.9.6+2-g7dfe8692b built with GNU Make 4.1, go1.14.3
  • Git version: git version 2.17.1
  • Operating system: Ubuntu 18.04
  • Database (use [x]):
    • PostgreSQL
    • [ x ] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [ x ] Not relevant
  • Log gist:

Description

Trying to run gitea using user git which worked on previous installation, continuously gives me error:
root@de /opt/gitea # sudo -u git -g git ./gitea web 2020/05/31 14:11:26 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.17.1 2020/05/31 14:11:26 routers/init.go:69:GlobalInit() [F] Git module init failed: Failed to set git user.name(exec(3:git.Init(set user.name)) failed: exit status 255(<nil>) stdout: stderr: warning: unable to access '/root/.gitconfig': Permission denied warning: unable to access '/root/.config/git/config': Permission denied error: could not lock config file /root/.gitconfig: Permission denied ): warning: unable to access '/root/.gitconfig': Permission denied warning: unable to access '/root/.config/git/config': Permission denied error: could not lock config file /root/.gitconfig: Permission denied

I tried making these files owned by git and chmod 0777 and the damn thing still won't start. If I run as root it runs fine. But I do not want to run gitea as root. Can you please help me :/ I'm really losing my mind and I've tried everything I could think off.

P.S.: I also tried older tags/versions and nothing seems to work...
...

Screenshots

Originally created by @Jackysi on GitHub (May 31, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): Gitea version 1.9.6+2-g7dfe8692b built with GNU Make 4.1, go1.14.3 - Git version: git version 2.17.1 - Operating system: Ubuntu 18.04 - Database (use `[x]`): - [ ] PostgreSQL - [ x ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [ x ] Not relevant - Log gist: ## Description Trying to run gitea using user git which worked on previous installation, continuously gives me error: `root@de /opt/gitea # sudo -u git -g git ./gitea web 2020/05/31 14:11:26 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.17.1 2020/05/31 14:11:26 routers/init.go:69:GlobalInit() [F] Git module init failed: Failed to set git user.name(exec(3:git.Init(set user.name)) failed: exit status 255(<nil>) stdout: stderr: warning: unable to access '/root/.gitconfig': Permission denied warning: unable to access '/root/.config/git/config': Permission denied error: could not lock config file /root/.gitconfig: Permission denied ): warning: unable to access '/root/.gitconfig': Permission denied warning: unable to access '/root/.config/git/config': Permission denied error: could not lock config file /root/.gitconfig: Permission denied` I tried making these files owned by git and chmod 0777 and the damn thing still won't start. If I run as root it runs fine. But I do not want to run gitea as root. Can you please help me :/ I'm really losing my mind and I've tried everything I could think off. P.S.: I also tried older tags/versions and nothing seems to work... ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
Author
Owner

@jolheiser commented on GitHub (May 31, 2020):

A couple comments.

  1. If you ever ran it as root, make sure any and all files Gitea created/modified are chowned appropriately afterwards
  2. I recall a conversation (apologies, I cannot recall when/where) that running with sudo also causes odd behavior.
    For example, in your log I see that Gitea is trying to access things in /root
  3. 1.9.6 is a fairly old version. The issues you're having don't seem related, but a large number of bugs have been fixed since then
@jolheiser commented on GitHub (May 31, 2020): A couple comments. 1. If you ever ran it as root, make sure any and all files Gitea created/modified are chowned appropriately afterwards 2. I recall a conversation (apologies, I cannot recall when/where) that running with sudo also causes odd behavior. For example, in your log I see that Gitea is trying to access things in `/root` 3. 1.9.6 is a fairly old version. The issues you're having don't seem related, but a large number of bugs have been fixed since then
Author
Owner

@Jackysi commented on GitHub (May 31, 2020):

1.) Did that chown git:git -R /opt/gitea and all other mentioned files in the error log
2.) I use service, sudo is just for testing, both have same error (service runs as git)
3.) Just updated to" Gitea version 1.13.0+dev-93-g34b6983f5 built with GNU Make 4.1, go1.14.3" same thing.

So I fixed it by running su git and running gitea web. Lucky that fixed it.
Thanks for all tips :) sudo really seems to be an issue.

@Jackysi commented on GitHub (May 31, 2020): 1.) Did that chown git:git -R /opt/gitea and all other mentioned files in the error log 2.) I use service, sudo is just for testing, both have same error (service runs as git) 3.) Just updated to" Gitea version 1.13.0+dev-93-g34b6983f5 built with GNU Make 4.1, go1.14.3" same thing. So I fixed it by running su git and running gitea web. Lucky that fixed it. Thanks for all tips :) sudo really seems to be an issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5478