Description
- Gitea version (or commit ref): 1.14.2
- Git version: 2.20.1
- Operating system: Debian 10
- Using gitea from the official downloads
- Running gitea using the sample systemd service
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
Description
My app.ini
doesn't explicitly configure any of the directories gitea uses, which means they're all set as their default values which are relative to AppWorkPath. In the systemd service, the GITEA_WORK_DIR
environment variable is explicitly set as /var/lib/gitea, which is where I set up all of gitea's directories, so everything works fine.
However, I'm running gitea using the system SSH server. In authorized_keys, that environment variable isn't set, which means that AppWorkPath defaults to the location of the gitea binary (/usr/local/bin, as recommended in the official install instructions). With an incorrect AppWorkPath, gitea can't find any of the files it needs to run (aside from /etc/gitea/app.ini, which is preserved as a command-line option in authorized_keys, but which doesn't explicitly configure any of the other directories on my system). Therefore, nobody can access their repositories over SSH.
To fix this, we need to do one of:
- add a setting in app.ini to explicitly configure AppWorkPath
- add the --work-path command-line flag to the command in authorized_keys, as was suggested in Need to add --work-path to authorized_keys #9481 but not implemented
- encourage placing the gitea binary in the desired work path, rather than in /usr/local/bin
- if the repository path, data path, etc, ought to be explicitly configured, then get rid of the defaults and die with an appropriate error when they're not configured