Skip to content

delete a user from command line ignores the -c switch with config file #17521

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

Closed
mariuz opened this issue Nov 2, 2021 · 4 comments · Fixed by #17779
Closed

delete a user from command line ignores the -c switch with config file #17521

mariuz opened this issue Nov 2, 2021 · 4 comments · Fixed by #17779

Comments

@mariuz
Copy link

mariuz commented Nov 2, 2021

Gitea Version

1.15.6

Git Version

git version 2.25.1

Operating System

ubuntu 20.04

How are you running Gitea?

i used the binary version with wget

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

create user from command line works ok and the website is ok , but the issues start when i try to delete a user

(ROOT = /home/git/gitea-repositories and works correctly)
so it tries to write in default folder and ignoring config file /etc/gitea/app.ini

gitea -c /etc/gitea/app.ini admin user delete --id 20

2021/11/02 11:46:42 ...s/storage/storage.go:171:initAttachments() [I] Initialising Attachment storage with type:
2021/11/02 11:46:42 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /usr/local/bin/data/attachments
2021/11/02 11:46:42 main.go:117:main() [F] Failed to run app with [gitea -c /etc/gitea/app.ini admin user delete --id 20]: mkdir /usr/local/bin/data: permission denied

Screenshots

No response

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Nov 2, 2021

You should use the correct app.ini (the one was already created by the first gitea setup), never use the non-related ones.

Make sure you are using the correct app.ini and make sure you run the gitea binary on the same system (host) as gitea web server.

@wxiaoguang wxiaoguang added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Nov 2, 2021
@zeripath

This comment has been minimized.

@wxiaoguang

This comment has been minimized.

@zeripath
Copy link
Contributor

zeripath commented Nov 2, 2021

@mariuz you likely need to set -w correctly.


Gitea as compiled by default is not really intended to get placed in /usr/local/bin or /usr/bin. It makes assumptions about where it is going to find things based upon the location of the binary. These assumptions can be overridden by environment variables and/or command line options but if those are not present the default locations will be used. The contrib systemd conf file sets the correct variables by default but your shell is not (nor should it be expected to).

In this case because the data path is not set within the app.ini it is assumed to be the data/ sub-directory of the "workpath" - that is the directory in which the gitea executable can be found.

Now, there are several ways of getting round this.

  1. There is a filesystem hierarchy compliant script that can be found in our contrib folder that I wrote with the intention that this would be what was placed in /usr/bin or /usr/local/bin and the gitea binary placed elsewhere.
  2. The other option is when compiling Gitea you can set some LDFLAGS to change the default locations
  3. Continue using environment variables and command line options.

@wxiaoguang wxiaoguang removed the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Nov 27, 2021
@wxiaoguang wxiaoguang linked a pull request Nov 27, 2021 that will close this issue
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants