Setting up Gitea

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
Markstar
Posts: 16
Joined: Tue Oct 22, 2019 12:15 pm

Setting up Gitea

Post by Markstar »

Hi,
I'm unfortunately still not really proficient in Linux and have trouble setting up Gitea:

After adding Gitea via dietpi-software, I am presented with the initial configuration screen (IP:3000). I changed the following settings:

"Database Settings":
Username: phpmyadmin
Password: [phpmyadmin password]

General Settings:
Repository Root Path: /mnt/vhd/gitea/data/gitea-repositories
GIT LFS Root Path: /mnt/vhd/gitea/data/lfs
Run as Username: git
SSH Server Domain: localhost
Log Path: /mnt/vhd/gitea/log

Before commiting the changes, I first created the user with this command:

Code: Select all

sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
as found here. Secondly, I created a directory as root with

Code: Select all

mkdir /mnt/vhd/gitea
and then changed the owner (hopefully) with

Code: Select all

chown git gitea/
(after having navigated to /mnt/vhd.

However, I get the following error:
The repository root path is invalid: mkdir /mnt/vhd/gitea/data: permission denied
Furthermore, I wonder if these settings are really secure. Can't somebody just log in with the git account externally?

Thank you in advance and I'm sorry if these are stupid questions. :?

Edit: I got it working after changing the "Run as Username" back to "dietpi" (and the folder permissions), though I don't quite understand why.
User avatar
MichaIng
Site Admin
Posts: 3088
Joined: Sat Nov 18, 2017 6:21 pm

Re: Setting up Gitea

Post by MichaIng »

Gitea has it's own database user (as all software that uses MariaDB, provide by DietPi-Software). Please check our docs, the "First run setup" tab: https://dietpi.com/docs/software/cloud/#gitea

The database password is btw not always "dietpi", but the global software password you either set via dietpi.txt before first boot, during firstrun setup or via dietpi-config, and only defaults to "dietpi". I'll fix that :).
User avatar
Joulinar
Posts: 5090
Joined: Sat Nov 16, 2019 12:49 am

Re: Setting up Gitea

Post by Joulinar »

I guess OP tried to create a new OS user to have Gitea running under this user. Usually it should have been enough to add these new user to user group

Code: Select all

dietpi
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3088
Joined: Sat Nov 18, 2017 6:21 pm

Re: Setting up Gitea

Post by MichaIng »

This was addressing:
"Database Settings":
Username: phpmyadmin
Password: [phpmyadmin password]
which is basically wrong, may work, when phpMyAdmin is installed, but not recommended to not grant Gitea admin permissions over the whole MariaDB server.

But indeed I somehow missed to read on. Not sure what the goal is to change the user, also AFAIK it is not possible like this as Gitea runs as user "dietpi", which cannot fork child processes as "git" user. So if for some reason a different user is wanted, the systemd unit itself needs to be changed:
dietpi-services > gitea > Edit > uncomment and changed User=dietpi to User=git and the Environment and WorkingDirectory accordingly. Not sure how far they are overridden by the settings chosen within the setup wizard.
CTRL+O to save, CTRL+X to quit the editor. When exiting dietpi-services, the service will restart automatically.
Post Reply