config file option for cli gitea admin change-password #1514

Closed
opened 2025-11-02 04:03:33 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @skimj on GitHub (Feb 10, 2018).

  • Gitea version (or commit ref): 1.3.2
  • Git version:
  • Operating system:
  • 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

The command gitea admin change-password fails with only this message: models.SetEngine: Failed to connect to database: Unknown database type: which leads me to believe that it isn't reading any database information from the config file. There doesn't appear to be an option to set the config file path when using the cli for this command (option looks to be available for other cli commands). I also tried copying my app.ini file into custom/conf/app.ini in a current working directory of /var/lib/gitea but got hte same error.

Originally created by @skimj on GitHub (Feb 10, 2018). - Gitea version (or commit ref): 1.3.2 - Git version: - Operating system: - 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 The command `gitea admin change-password` fails with only this message: `models.SetEngine: Failed to connect to database: Unknown database type:` which leads me to believe that it isn't reading any database information from the config file. There doesn't appear to be an option to set the config file path when using the cli for this command (option looks to be available for other cli commands). I also tried copying my app.ini file into custom/conf/app.ini in a current working directory of /var/lib/gitea but got hte same error.
GiteaMirror added the type/docs label 2025-11-02 04:03:33 -06:00
Author
Owner

@bkcsoft commented on GitHub (Feb 10, 2018):

Maybe the --config flag should be global instead. Since everything have to use it 🤔

@bkcsoft commented on GitHub (Feb 10, 2018): Maybe the `--config` flag should be global instead. Since everything have to use it 🤔
Author
Owner

@rterbush commented on GitHub (Apr 17, 2018):

Running into this same issue on a FreeBSD install using Sqlite. Config file is located in /usr/local/etc/gitea/conf/app.ini

@rterbush commented on GitHub (Apr 17, 2018): Running into this same issue on a FreeBSD install using Sqlite. Config file is located in /usr/local/etc/gitea/conf/app.ini
Author
Owner

@rterbush commented on GitHub (Apr 17, 2018):

This issue is actually solved when environment variable GITEA_CUSTOM is set properly. After setting GITEA_CUSTOM=/usr/local/etc/gitea, my above example works as expected.

@rterbush commented on GitHub (Apr 17, 2018): This issue is actually solved when environment variable GITEA_CUSTOM is set properly. After setting GITEA_CUSTOM=/usr/local/etc/gitea, my above example works as expected.
Author
Owner

@MrHaroldA commented on GitHub (Jun 8, 2018):

I've run into this too; on Arch Linux, app.ini is installed as /etc/gitea/app.ini, so even when I set GITEA_CUSTOM=/etc/gitea, the admin CLI won't work because it tries to find /etc/gitea/conf/app.ini.

Making the --config global will fix this for me.

@MrHaroldA commented on GitHub (Jun 8, 2018): I've run into this too; on Arch Linux, app.ini is installed as /etc/gitea/app.ini, so even when I set GITEA_CUSTOM=/etc/gitea, the admin CLI won't work because it tries to find /etc/gitea/**conf**/app.ini. Making the --config global will fix this for me.
Author
Owner

@Freccia commented on GitHub (Jul 3, 2018):

Hello, since I couldn't find any documentation about such option (--config global) and I couldn't manage to make it work with gitea admin change-password, I used this to fix the issue:

sudo mkdir /etc/gitea/conf; sudo ln -s /etc/gitea/app.ini /etc/gitea/conf/app.ini
GITEA_CUSTOM=/etc/gitea git admin change-password -u user -p mynewsecurepasswd

@Freccia commented on GitHub (Jul 3, 2018): Hello, since I couldn't find any documentation about such option (`--config global`) and I couldn't manage to make it work with `gitea admin change-password`, I used this to fix the issue: `sudo mkdir /etc/gitea/conf; sudo ln -s /etc/gitea/app.ini /etc/gitea/conf/app.ini` `GITEA_CUSTOM=/etc/gitea git admin change-password -u user -p mynewsecurepasswd`
Author
Owner

@vegardx commented on GitHub (Aug 19, 2019):

The documentation seems somewhat inconsistent, and --custom-path isn't a valid option. It will just error out complaining about missing value. You can export GITEA_CUSTOM as your config path, eg /etc/gitea, and then use --config app.ini (as a global option).

I struggle to see the benefit of using relative paths for --config, this should really take an absolute path. I also don't understand the changes made and referenced earlier in this issue where --config was added (but not mentioned in official documentation, perhaps reverted?) as an argument (but referred to as an option) with overlapping naming for global options.

https://github.com/go-gitea/gitea/pull/4184/files#diff-e7eae7f3890550dab75286171f96fa07R65

@vegardx commented on GitHub (Aug 19, 2019): The documentation seems somewhat inconsistent, and `--custom-path` isn't a valid option. It will just error out complaining about missing value. You can export `GITEA_CUSTOM` as your config path, eg `/etc/gitea`, and then use `--config app.ini` (as a global option). I struggle to see the benefit of using relative paths for `--config`, this should really take an absolute path. I also don't understand the changes made and referenced earlier in this issue where `--config` was added (but not mentioned in official documentation, perhaps reverted?) as an argument (but referred to as an option) with overlapping naming for global options. https://github.com/go-gitea/gitea/pull/4184/files#diff-e7eae7f3890550dab75286171f96fa07R65
Author
Owner

@ghost commented on GitHub (Jun 14, 2020):

Every time you use gitea you need to use it with the config file added, like so:
gitea --config /etc/gitea/app.ini admin create-user --username ...

@ghost commented on GitHub (Jun 14, 2020): Every time you use `gitea` you need to use it with the config file added, like so: `gitea --config /etc/gitea/app.ini admin create-user --username ...`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1514