Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change behavior for GITEA_WORK_DIR #1419

Closed
exap opened this issue Mar 30, 2017 · 6 comments
Closed

Change behavior for GITEA_WORK_DIR #1419

exap opened this issue Mar 30, 2017 · 6 comments
Labels
Milestone

Comments

@exap
Copy link

exap commented Mar 30, 2017

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
@andreynering andreynering added this to the 1.2.0 milestone Mar 30, 2017
@ghost
Copy link

ghost commented Apr 2, 2017

Can you post your gitea configuration file or at least tell me if the path to your database is absolute?
If it is absolute, then I think there is a bug. If it is relative, you should set the GITEA_WORK_DIR environment variable for the user running gitea as you already did, but in a more conventional place.

@exap
Copy link
Author

exap commented Apr 9, 2017

Is was relative. Thanks for that.

But this doesn't solve the unexpected behavior of GITEA_WOKR_DIR.

@lunny
Copy link
Member

lunny commented Apr 20, 2017

GITEA_WORK_DIR should be set yourself in your shell profile?

@strk
Copy link
Member

strk commented Apr 20, 2017

I agree the behavior should be for the default to be $PWD, not the name of the directory containing the binary.

@exap
Copy link
Author

exap commented Apr 22, 2017

GITEA_WORK_DIR should be set yourself in your shell profile?

Yes. But this isn't the point of this issue. Also, in my opinion it's not documentend well enough, that you should set GITEA_WORK_DIR.

@lunny lunny modified the milestones: 1.x.x, 1.2.0 May 25, 2017
@lafriks lafriks modified the milestones: 1.x.x, 1.3.0 Nov 3, 2017
@lafriks
Copy link
Member

lafriks commented Nov 3, 2017

I think it's fixed by #2192. Reopen if there is still issue

@lafriks lafriks closed this as completed Nov 3, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants