How to Install Gitea on Your Synology NAS

How to Install Gitea on Your Synology NAS

Gitea is a painless self-hosted Git service written in GO, and very lightweight. It is somewhat similar to GitHub, Bitbucket and Gitlab. As well as support for Git revision control, it also provides issue tracking and wiki pages development. If you are looking for an alternative to Gitea, check out my article for Forgejo. In this step by step guide I will show you how to install Gitea on your Synology NAS using Docker and Portainer.

💡Note: This guide works perfectly with the latest Gitea v1.22.3 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.

  • STEP 4

Install Text Editor via Synology “Package Center”. (Mandatory STEP.) If you already have Text Editor installed on your Synology NAS, skip this STEP.

Synology Install Text Editor 2023

  • STEP 5

Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

Gitea Synology NAS Set up 1

  • STEP 6

Now click the “Create” button. Follow the instructions in the image below.

Gitea Synology NAS Set up 2

  • STEP 7

After you click the Create button, the window below will open. Follow the instructions in the image below.

On the General area, set the Reverse Proxy Name description: type in Gitea. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: gitea.yourname.synology.me
Port: 443

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 3052

Gitea Synology NAS Set up 3

  • STEP 8

On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.

Synology Proxy WebSocket

  • STEP 9

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

Gitea Synology NAS Set up 4

  • STEP 10

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

Gitea Synology NAS Set up 5

  • STEP 11

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it gitea. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Gitea Synology NAS Set up 6

  • STEP 12

Now create two new folders inside the gitea folder that you created at STEP 11 and name them data and db. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Gitea Synology NAS Set up 7

  • STEP 13

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 14

In the Name field type in gitea. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

services:
  db:
    image: postgres:17
    container_name: Gitea-DB
    hostname: gitea-db
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "gitea", "-U", "giteauser"]
      timeout: 45s
      interval: 10s
      retries: 10
    volumes:
      - /volume1/docker/gitea/db:/var/lib/postgresql/data:rw
    environment:
      - POSTGRES_DB=gitea
      - POSTGRES_USER=giteauser
      - POSTGRES_PASSWORD=giteapass
    restart: on-failure:5

  web:
    image: gitea/gitea:latest
    container_name: Gitea
    hostname: gitea
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1
    ports:
      - 3052:3000
      - 2222:22
    volumes:
      - /volume1/docker/gitea/data:/data
      - /etc/TZ:/etc/TZ:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - USER_UID=1026
      - USER_GID=100
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=gitea-db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=giteauser
      - GITEA__database__PASSWD=giteapass
      - ROOT_URL=https://gitea.yourname.synology.me
    restart: on-failure:5

Note: Before you paste the code above in the Web editor area below, change the value numbers for USER_UID and USER_GID with your own values. (Follow my step by step guide on how to do this.) 1026 is my personal USER_UID value and 100 is my personal USER_GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for ROOT_URL and type in your own synology.me DDNS with https:// at the beginning that you have previously created at STEP 7.

Gitea Synology NAS Set up 8 new 2025

  • STEP 15

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

Gitea Synology NAS Set up 9 new 2025

  • STEP 16

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

Gitea Synology NAS Set up 10

  • STEP 17

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 18

Now open your browser and type in your HTTPS/SSL certificate like this https://gitea.yourname.synology.me In my case it’s https://gitea.mariushosting.synology.me If everything goes right, you will see the Gitea configuration page. Type in your Company Name then scroll down on the page. Follow the instructions in the image below.

Gitea Synology NAS Set up 11

  • STEP 19

On the Server Domain field type in your own synology.me DDNS that you have previously created at STEP 7 without https at the beginning. On the SSH Server Port type in 2222 instead of 22. On the Gitea Base URL field type in your own synology.me DDNS that you have previously created at STEP 7 with https at the beginning. Click Email Settings. Follow the instructions in the image below.

Gitea Synology NAS Set up 10 new 2023

  • STEP 20

Follow my step by step guide on how to activate SMTP for your Gmail account. This step is mandatory. Note: If you don’t want to use the easiest way for SMTP with Google and you already have SMTP details from your own Mail Server, you can just skip this STEP and use your personalized email SMTP details instead.

  • STEP 21

Add your own SMTP details. Follow the instructions in the image below.

SMTP Host: smtp.gmail.com
SMTP Port: 465
Send Email As: Type in your own Gmail address.
SMTP Username: Type in your own Gmail address.
SMTP Password: Type in your own Gmail App Password / STEP 20.

Click Install Gitea.

Gitea Synology NAS Set up 11 new 2023

  • STEP 22

After you click Install Gitea at STEP 21, you will get a synology blank page error message because the installation is not finished. Refresh the page to solve the temporary issue. At the top right of the page click Register. Follow the instructions in the image below.

Gitea Synology NAS Set up 13

  • STEP 23

Type in your own Username, Email Address and Password. Confirm the Password then click Register Account. Follow the instructions in the image below.

Gitea Synology NAS Set up 14

  • STEP 24

At the top right of the page select Settings. In this area you can change different parameters on your Gitea installation. For example, you can switch the theme to Dark Mode. Select arc-green then Update Theme. Follow the instructions in the image below.

Gitea Synology NAS Set up 15

Your Gitea Dashboard at a Glance!

Gitea Synology NAS Set up 16

  • STEP 25

If you want to modify some settings in Gitea, for example disable user registration, continue to follow the instructions. Make sure you have installed Synology Text Editor as per the instructions at STEP 4. In File Station go to docker / gitea / data / gitea / conf and double click on the app.ini file. Scroll down until you find DISABLE_REGISTRATION and type in true instead of false. Click X to save the file. Follow the instructions in the image below.

Gitea Synology NAS Set up 17

  • STEP 26

To apply the settings, you have to restart the Gitea container. On the left sidebar in Portainer, click Containers. Identify your Gitea instance, select it then click Restart. Follow the instructions in the image below.

Gitea Synology NAS Set up 18

Enjoy Gitea!

🆘TROUBLESHOOTING

If you encounter issues by using this container, make sure to check out the Common Docker issues article.

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Back Up Docker Containers on your Synology NAS.
Note: Find out how to update the Gitea container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: Instead of the synology.me DDNS you can also use your own domain name.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Wednesday / October 9th, 2024 at 2:03 PM