Description
Background
If I add SSH keys, I won't be able to log in. I get this error message:
[...io/gitea/cmd/serv.go:99 runServ()] [F] setup: Failed to connect to database: Failed to create directories: mkdir data: permission denied
in /var/log/gitea/serv.log
.
To fix this, I have to replace
command="/usr/bin/gitea serv key-3 --config=/etc/gitea/app.ini"
with
command="GITEA_WORK_DIR=/var/lib/gitea /usr/bin/gitea serv key-3 --config=/etc/gitea/app.ini"
in .ssh/authorized_keys
.
Change behavior for GITEA_WORK_DIR
A quick check with strace
shows, that gitea
does a
chdir("/usr/bin")
followed by a
stat64("data", 0x11f99614) = -1 ENOENT (No such file or directory)
.
You can find this chdir
in cmd/serv.go.
I don't get why this environment variable is defaulted to /usr/bin
. By default it should be pwd
.
I first tried to write
command="cd /var/lib/gitea && /usr/bin/gitea serv key-3 --config=/etc/gitea/app.ini"
and this (obviously) didn't work for this reason.
Setup
- Gitea: 1.1.0