Custom paths not as expected: installation problem? #6587

Closed
opened 2025-11-02 07:00:19 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @jbhanks on GitHub (Dec 27, 2020).

I am trying to set up customizations according to this:
https://docs.gitea.io/en-us/customizing-gitea/#:~:text=You%20can%20check%20the%20CustomPath,option%20on%20the%20gitea%20binary.

It says that by running gitea help I can get the custom path and other paths. However, I only see the defaults listed, and those do not exist on my system. Am I supposed to create them manually?

By looking at the admin panel, I found that the location was actually ls /var/lib/gitea/custom, but that folder was empty. Shouldn't there be a copy of app.ini there (mine is at /etc/gitea/app.ini)?

As I installed directly from the gitea site and not via a distribution, I am confused about whether this is how it is supposed to be or not. Did something go wrong in my installation or are those docs outdated.

I downloaded gitea from https://dl.gitea.io/gitea/1.13.0/gitea-1.13.0-linux-amd64

$ gitea help
NAME:
   Gitea - A painless self-hosted Git service

USAGE:
   gitea [global options] command [command options] [arguments...]

VERSION:
   1.13.0 built with GNU Make 4.1, go1.15.5 : bindata, sqlite, sqlite_unlock_notify

DESCRIPTION:
   By default, gitea will start serving using the webserver with no
arguments - which can alternatively be run by running the subcommand web.

COMMANDS:
     web              Start Gitea web server
     serv             This command should only be called by SSH shell
     hook             Delegate commands to corresponding Git hooks
     dump             Dump Gitea files and database
     cert             Generate self-signed certificate
     admin            Command line interface to perform common administrative operations
     generate         Command line interface for running generators
     migrate          Migrate the database
     keys             This command queries the Gitea database to get the authorized command for a given ssh key fingerprint
     convert          Convert the database
     doctor           Diagnose problems
     manager          Manage the running gitea process
     embedded         Extract embedded resources
     migrate-storage  Migrate the storage
     help, h          Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --port value, -p value         Temporary port number to prevent conflict (default: "3000")
   --pid value, -P value          Custom pid file path (default: "/run/gitea.pid")
   --custom-path value, -C value  Custom path file path (default: "/usr/local/bin/custom")
   --config value, -c value       Custom configuration file path (default: "/usr/local/bin/custom/conf/app.ini")
   --version, -v                  print the version
   --work-path value, -w value    Set the gitea working path (default: "/usr/local/bin")
   --help, -h                     show help

DEFAULT CONFIGURATION:
     CustomPath:  /usr/local/bin/custom 
     CustomConf:  /usr/local/bin/custom/conf/app.ini
     AppPath:     /usr/local/bin/gitea
     AppWorkPath: /usr/local/bin
$ ls /usr/local/bin/custom
ls: cannot access '/usr/local/bin/custom': No such file or directory

$ cat /usr/local/bin/custom/conf/app.ini
cat: /usr/local/bin/custom/conf/app.ini: No such file or directory

Originally created by @jbhanks on GitHub (Dec 27, 2020). I am trying to set up customizations according to this: https://docs.gitea.io/en-us/customizing-gitea/#:~:text=You%20can%20check%20the%20CustomPath,option%20on%20the%20gitea%20binary. It says that by running `gitea help` I can get the custom path and other paths. However, I only see the defaults listed, and those do not exist on my system. Am I supposed to create them manually? By looking at the admin panel, I found that the location was actually `ls /var/lib/gitea/custom`, but that folder was empty. Shouldn't there be a copy of `app.ini` there (mine is at ` /etc/gitea/app.ini`)? As I installed directly from the gitea site and not via a distribution, I am confused about whether this is how it is supposed to be or not. Did something go wrong in my installation or are those docs outdated. I downloaded gitea from https://dl.gitea.io/gitea/1.13.0/gitea-1.13.0-linux-amd64 ``` $ gitea help NAME: Gitea - A painless self-hosted Git service USAGE: gitea [global options] command [command options] [arguments...] VERSION: 1.13.0 built with GNU Make 4.1, go1.15.5 : bindata, sqlite, sqlite_unlock_notify DESCRIPTION: By default, gitea will start serving using the webserver with no arguments - which can alternatively be run by running the subcommand web. COMMANDS: web Start Gitea web server serv This command should only be called by SSH shell hook Delegate commands to corresponding Git hooks dump Dump Gitea files and database cert Generate self-signed certificate admin Command line interface to perform common administrative operations generate Command line interface for running generators migrate Migrate the database keys This command queries the Gitea database to get the authorized command for a given ssh key fingerprint convert Convert the database doctor Diagnose problems manager Manage the running gitea process embedded Extract embedded resources migrate-storage Migrate the storage help, h Shows a list of commands or help for one command GLOBAL OPTIONS: --port value, -p value Temporary port number to prevent conflict (default: "3000") --pid value, -P value Custom pid file path (default: "/run/gitea.pid") --custom-path value, -C value Custom path file path (default: "/usr/local/bin/custom") --config value, -c value Custom configuration file path (default: "/usr/local/bin/custom/conf/app.ini") --version, -v print the version --work-path value, -w value Set the gitea working path (default: "/usr/local/bin") --help, -h show help DEFAULT CONFIGURATION: CustomPath: /usr/local/bin/custom CustomConf: /usr/local/bin/custom/conf/app.ini AppPath: /usr/local/bin/gitea AppWorkPath: /usr/local/bin ``` ``` $ ls /usr/local/bin/custom ls: cannot access '/usr/local/bin/custom': No such file or directory $ cat /usr/local/bin/custom/conf/app.ini cat: /usr/local/bin/custom/conf/app.ini: No such file or directory ```
GiteaMirror added the type/question label 2025-11-02 07:00:19 -06:00
Author
Owner

@lunny commented on GitHub (Dec 27, 2020):

How did you run Gitea? Some environment variables may change them.

@lunny commented on GitHub (Dec 27, 2020): How did you run `Gitea`? Some environment variables may change them.
Author
Owner

@jbhanks commented on GitHub (Dec 27, 2020):

I run it as a service, I set it up like this (on Ubuntu 20.04)

wget -O gitea https://dl.gitea.io/gitea/1.13.0/gitea-1.13.0-linux-amd64
wget gitea https://dl.gitea.io/gitea/1.13.0/gitea-1.13.0-linux-amd64.asc

gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --verify gitea-1.13.0-linux-amd64.asc gitea

sudo chmod +x gitea
sudo mv gitea /usr/local/bin/gitea

wget https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service


sudo cp gitea.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable gitea
sudo systemctl start gitea
@jbhanks commented on GitHub (Dec 27, 2020): I run it as a service, I set it up like this (on Ubuntu 20.04) ``` wget -O gitea https://dl.gitea.io/gitea/1.13.0/gitea-1.13.0-linux-amd64 wget gitea https://dl.gitea.io/gitea/1.13.0/gitea-1.13.0-linux-amd64.asc gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2 gpg --verify gitea-1.13.0-linux-amd64.asc gitea sudo chmod +x gitea sudo mv gitea /usr/local/bin/gitea wget https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service sudo cp gitea.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable gitea sudo systemctl start gitea ```
Author
Owner

@lunny commented on GitHub (Dec 27, 2020):

You can find WorkingDirectory=/var/lib/gitea/, so maybe you can take a look at that directory.

@lunny commented on GitHub (Dec 27, 2020): You can find `WorkingDirectory=/var/lib/gitea/`, so maybe you can take a look at that directory.
Author
Owner

@zeripath commented on GitHub (Dec 27, 2020):

The gitea.service file runs Gitea with /var/lib/gitea as the working directory as @lunny states above and it runs the specific config /etc/gitea/app.ini

If you were to run:

cd /var/lib/gitea
USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea /usr/local/bin/gitea --config /etc/gitea/app.ini help

may give you a closer approximation of the environment - however the first 4 lines emitted by gitea web on stdout give you some more information about how gitea is configured.

@zeripath commented on GitHub (Dec 27, 2020): The gitea.service file runs Gitea with /var/lib/gitea as the working directory as @lunny states above and it runs the specific config /etc/gitea/app.ini If you were to run: ```bash cd /var/lib/gitea USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea /usr/local/bin/gitea --config /etc/gitea/app.ini help ``` may give you a closer approximation of the environment - however the first 4 lines emitted by gitea web on stdout give you some more information about how gitea is configured.
Author
Owner

@jbhanks commented on GitHub (Dec 27, 2020):

/var/lib/gitea/custom/ exists, but is empty. Shouldn't the "options" folder have been created automatically? I created the custom/options folder and put file called "gitignore" in there (and restarted the gitea service), but that file is not being used as a default .gitignore.

In app.ini, I do not see a variable for custom path.

@jbhanks commented on GitHub (Dec 27, 2020): `/var/lib/gitea/custom/` exists, but is empty. Shouldn't the "options" folder have been created automatically? I created the `custom/options` folder and put file called "gitignore" in there (and restarted the gitea service), but that file is not being used as a default .gitignore. In app.ini, I do not see a variable for custom path.
Author
Owner

@zeripath commented on GitHub (Dec 28, 2020):

Shouldn't the "options" folder have been created automatically?

nope why should it?

I created the custom/options folder and put file called "gitignore" in there (and restarted the gitea service), but that file is not being used as a default .gitignore.

It should be a named file in custom/options/gitignore/ e.g. custom/options/gitignore/jbhanks

@zeripath commented on GitHub (Dec 28, 2020): > Shouldn't the "options" folder have been created automatically? nope why should it? > I created the custom/options folder and put file called "gitignore" in there (and restarted the gitea service), but that file is not being used as a default .gitignore. It should be a named file in `custom/options/gitignore/` e.g. `custom/options/gitignore/jbhanks`
Author
Owner

@jbhanks commented on GitHub (Dec 29, 2020):

Ok, that was not at all clear to me from the documentation I linked to above, which says:

To add custom .gitignore, add a file with existing .gitignore rules in it to custom/options/gitignore

Any any case, I still don't get what I am supposed to do to set up a custom .gitignore.

I did:

sudo mkdir -p /var/lib/gitea/custom/options/gitignore/jbhanks

cat<<EOF|sudo tee /var/lib/gitea/custom/options/gitignore/jbhanks/.gitignore
env
env/*
old/*
*__pycache__/*
EOF

sudo systemctl restart gitea

Then I created a new repo in gitea with "initialize repository" checked, but there was no .gitignore in the new repo. Am I misunderstanding how this is supposed to work?

@jbhanks commented on GitHub (Dec 29, 2020): Ok, that was not at all clear to me from the documentation I linked to above, which says: > To add custom .gitignore, add a file with existing .gitignore rules in it to custom/options/gitignore Any any case, I still don't get what I am supposed to do to set up a custom .gitignore. I did: ``` sudo mkdir -p /var/lib/gitea/custom/options/gitignore/jbhanks cat<<EOF|sudo tee /var/lib/gitea/custom/options/gitignore/jbhanks/.gitignore env env/* old/* *__pycache__/* EOF sudo systemctl restart gitea ``` Then I created a new repo in gitea with "initialize repository" checked, but there was no .gitignore in the new repo. Am I misunderstanding how this is supposed to work?
Author
Owner

@Masgalor commented on GitHub (Jan 4, 2021):

You are slightly misunderstanding what these files are supposed to do.

You can not set some default gitignore that appears in every new repo.
All you can do is extend the list of available templates.
During creation of a new repo you can choose one or more templates that are combined and than included in your repo.
Unbenannt

If you want to add a template you need to place a named file in custom/options/gitignore/. (as zeripath already told you)
Here is a corrected version of your steps, assuming you are running the service as user "gitea".

sudo mkdir -p /var/lib/gitea/custom/options/gitignore

cat<<EOF|sudo tee /var/lib/gitea/custom/options/gitignore/jbhanks
env
env/*
old/*
*__pycache__/*
EOF

sudo chown -R gitea:gitea /var/lib/gitea
sudo systemctl restart gitea

If everything is correct you will see the entry "jbhanks" in the list of available gitignore templates.

@Masgalor commented on GitHub (Jan 4, 2021): You are slightly misunderstanding what these files are supposed to do. You can not set some default gitignore that appears in every new repo. All you can do is extend the list of available templates. During creation of a new repo you can choose one or more templates that are combined and than included in your repo. ![Unbenannt](https://user-images.githubusercontent.com/30129213/103542623-7e41b700-4e9d-11eb-887a-fdc7ad7932d4.JPG) If you want to add a template you need to place a named file in `custom/options/gitignore/`. (as zeripath already told you) Here is a corrected version of your steps, assuming you are running the service as user "gitea". ``` sudo mkdir -p /var/lib/gitea/custom/options/gitignore cat<<EOF|sudo tee /var/lib/gitea/custom/options/gitignore/jbhanks env env/* old/* *__pycache__/* EOF sudo chown -R gitea:gitea /var/lib/gitea sudo systemctl restart gitea ``` If everything is correct you will see the entry "jbhanks" in the list of available gitignore templates.
Author
Owner

@jbhanks commented on GitHub (Jan 4, 2021):

Thank you for clarifying, it was not at all obvious to me how that was supposed to work.

@jbhanks commented on GitHub (Jan 4, 2021): Thank you for clarifying, it was not at all obvious to me how that was supposed to work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6587