Hi, I am new to gitea and not a Linux expert. I managed to install gitea on Ubuntu 18.04 with Apache more or less follwing this tutorial
When I start gitea with sudo /usr/local/bin/gitea web -c /opt/gitea/app.ini
, then the page for setting up configuration at my server is available. But when I try to do this via a service it does not work.
sudo service gitea start
and sudo service gitea status
give me
● gitea.service - Gitea (Git with a cup of tea)
Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-04-24 11:27:17 CEST; 1s ago
Process: 32532 ExecStart=/usr/local/bin/gitea web -c /opt/gitea/app.ini (code=exited, status=1/FAILURE)
Main PID: 32532 (code=exited, status=1/FAILURE)
and in the browser I see a 503 Service unavailable.
more details gives me journalctl -b 0 -u gitea
:
Apr 19 13:20:30 Ubuntu-1804-bionic-64-minimal systemd[1]: Started Gitea (Git with a cup of tea).
Apr 19 13:20:30 Ubuntu-1804-bionic-64-minimal gitea[22399]: panic: Git version missing: exec: "git": executable file not found in $PATH
Apr 19 13:20:30 Ubuntu-1804-bionic-64-minimal gitea[22399]: goroutine 1 [running]:
Apr 19 13:20:30 Ubuntu-1804-bionic-64-minimal gitea[22399]: code.gitea.io/gitea/vendor/code.gitea.io/git.init.0()
Apr 19 13:20:30 Ubuntu-1804-bionic-64-minimal gitea[22399]: /go/src/code.gitea.io/gitea/vendor/code.gitea.io/git/git.go:76 +0x1a3
Apr 19 13:20:30 Ubuntu-1804-bionic-64-minimal systemd[1]: gitea.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 19 13:20:30 Ubuntu-1804-bionic-64-minimal systemd[1]: gitea.service: Failed with result 'exit-code'.
Apr 19 13:20:32 Ubuntu-1804-bionic-64-minimal systemd[1]: gitea.service: Service hold-off time over, scheduling restart.
Apr 19 13:20:32 Ubuntu-1804-bionic-64-minimal systemd[1]: gitea.service: Scheduled restart job, restart counter is at 1.
Apr 19 13:20:32 Ubuntu-1804-bionic-64-minimal systemd[1]: Stopped Gitea (Git with a cup of tea).
So why is git executable not found?
sudo git --version
returns git version 2.17.1
I really googled a lot to find out but here I’m stuck.
My Service configuration looks like this
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
After=mysqld.service
#After=postgresql.service
#After=memcached.service
#After=redis.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/opt/gitea/
ExecStart=/usr/local/bin/gitea web -c /opt/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/opt/gitea
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
About the PATH:
which git
returns /usr/bin/git
and sudo env | grep ^PATH
returns PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin