# \[SOLVED\] Gitea Service is not starting

**URL:** <https://forum.gitea.com/t/solved-gitea-service-is-not-starting/1111>\
**Category:** Install/Maintain/Configure\
**Created:** [April 24, 2019, 9:37am UTC](https://forum.gitea.com/t/solved-gitea-service-is-not-starting/1111 "2019-04-24T09:37:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shoplifter](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/shoplifter/32/537_2.png) [@Shoplifter](https://forum.gitea.com/u/Shoplifter)\
**Post date:** [April 24, 2019, 9:37am UTC](https://forum.gitea.com/t/solved-gitea-service-is-not-starting/1111/1 "2019-04-24T09:37:21Z")

</div>

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](https://mindefrag.net/2018/07/how-to-install-and-configure-gitea-a-self-hosted-github-like-service/)  
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

```auto
● 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`:

```auto
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

```auto
[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`

---

<div class="post-metadata">

**Author:** ![chk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/chk/32/476_2.png) [@chk](https://forum.gitea.com/u/chk)\
**Post date:** [April 25, 2019, 5:59pm UTC](https://forum.gitea.com/t/solved-gitea-service-is-not-starting/1111/2 "2019-04-25T17:59:12Z")

</div>

Odd. Have you tried explicitly setting the path inside the unit file?

> [@Shoplifter](#):
>
> ```auto
> Environment= ... PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
> 
> ```

If it still doesn’t work, you should wrap the `ExecStart` command with a shell, echo PATH to stdout before gitea runs, and then inspect systemd logs.

---

<div class="post-metadata">

**Author:** ![Shoplifter](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/shoplifter/32/537_2.png) [@Shoplifter](https://forum.gitea.com/u/Shoplifter)\
**Post date:** [April 28, 2019, 10:49am UTC](https://forum.gitea.com/t/solved-gitea-service-is-not-starting/1111/3 "2019-04-28T10:49:54Z")

</div>

Thanks for your answer. I tried the solution you provided and it worked. The I removed it again (since it really should be unnecessary) and it still worked. No idea what I did wrong in the first place, but thanks a lot anyways.

I am still running into problems with letsencrypt resp. reverse proxy config though, but I think better start a [new thread](https://forum.gitea.com/t/apache-proxy-error-502/1120) for that one.

---

<div class="post-metadata">

**Author:** ![CoolGoose](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/coolgoose/32/4840_2.png) [@CoolGoose](https://forum.gitea.com/u/CoolGoose)\
**Post date:** [June 17, 2019, 10:07am UTC](https://forum.gitea.com/t/solved-gitea-service-is-not-starting/1111/4 "2019-06-17T10:07:40Z")

</div>

If anybody else hits this thread, I had a similar issue, but unfortunately I wasn’t that fortunate to see that gitea wasn’t seeing git.

My `journalctl -b 0 -u gitea` only said

```auto

Jun 17 13:01:42 gitea.example.org systemd[1]: Started Gitea gitlabselfhost instance.
Jun 17 13:01:42 gitea.example.org systemd[1]: giteaselfhost.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Jun 17 13:01:42 gitea.example.org systemd[1]: Unit giteaselfhost.service entered failed state.
Jun 17 13:01:42 gitea.example.org systemd[1]: giteaselfhost.service failed.

```

The problem was that my ‘git’ is in a custom path, so the adding the path in the service worked for me.  
I suspect that maybe the person above forgot to daemon-reload systemd so that’s why it’s still working ?

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [May 11, 2026, 6:02pm UTC](https://forum.gitea.com/t/solved-gitea-service-is-not-starting/1111/5 "2026-05-11T18:02:15Z")

</div>


