why When gitea Run as Windows Service Mode can not get the config,but succ in command type? #2001

Closed
opened 2025-11-02 04:20:43 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @wadereye on GitHub (Jul 3, 2018).

  • Gitea version (or commit ref):1.4.3
  • Git version:2.1.2
  • Operating system:Windows 2008 R2
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • [ X] SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • [ X] No
    • Not relevant
  • Log gist:

Description

When I use Command mode,I start gitea normal,and then ,I can sign in the website,and use all the function very well.

But I try to close the command window,and register the gitea as windows service as the follow command:
sc create gitea start= auto binPath= ""C:\gitea\gitea.exe" web --config "C:\gitea\custom\conf\app.ini""
I am sure I replace the dir to my local dir.
and the service start well,I can also open the website.
but ,I can not sign In.And the website remind me user login error.
then, I Remove the service,and try to open in command window.it work well.
then,I run as windows service again.I got the same error as before.

any body has the same error?or what is the wrong way I did?

Thanks.
...

Screenshots

Originally created by @wadereye on GitHub (Jul 3, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) 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):1.4.3 - Git version:2.1.2 - Operating system:Windows 2008 R2 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ X] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ X] No - [ ] Not relevant - Log gist: ## Description When I use Command mode,I start gitea normal,and then ,I can sign in the website,and use all the function very well. But I try to close the command window,and register the gitea as windows service as the follow command: sc create gitea start= auto binPath= ""C:\gitea\gitea.exe" web --config "C:\gitea\custom\conf\app.ini"" I am sure I replace the dir to my local dir. and the service start well,I can also open the website. but ,I can not sign In.And the website remind me user login error. then, I Remove the service,and try to open in command window.it work well. then,I run as windows service again.I got the same error as before. any body has the same error?or what is the wrong way I did? Thanks. ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/question label 2025-11-02 04:20:43 -06:00
Author
Owner

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

Because windows service working directory is always c:\windows\system32. You need to define gitea data directory system environment variable with the gitea data directory

@lafriks commented on GitHub (Jul 3, 2018): Because windows service working directory is always c:\windows\system32. You need to define gitea data directory system environment variable with the gitea data directory
Author
Owner

@wadereye commented on GitHub (Aug 4, 2018):

Thanks,I Got it.thank you very much!

@wadereye commented on GitHub (Aug 4, 2018): Thanks,I Got it.thank you very much!
Author
Owner

@fipcomatt commented on GitHub (Nov 19, 2018):

@lafriks can you state explicitly what the "gitea data directory system environment variable" is named? I've tried setting 'GITEA_DATA', 'GITEA_DATA_DIR', 'APP_DATA_PATH', 'GITEA_CUSTOM_DIR', and 'GITEA_WORK_DIR' and none seem to have any effect.

@fipcomatt commented on GitHub (Nov 19, 2018): @lafriks can you state explicitly what the "gitea data directory system environment variable" is named? I've tried setting 'GITEA_DATA', 'GITEA_DATA_DIR', 'APP_DATA_PATH', 'GITEA_CUSTOM_DIR', and 'GITEA_WORK_DIR' and none seem to have any effect.
Author
Owner

@lunny commented on GitHub (Nov 20, 2018):

Maybe we need update docs about windows service best practice.

@lunny commented on GitHub (Nov 20, 2018): Maybe we need update docs about windows service best practice.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2001